format code
This commit is contained in:
@@ -70,7 +70,8 @@ def add_data(
|
|||||||
|
|
||||||
_, collection = _get_client_and_collection(collection_name)
|
_, collection = _get_client_and_collection(collection_name)
|
||||||
|
|
||||||
embeddings: list[Sequence[float]] = [record["embedding"] for record in data]
|
embeddings: list[Sequence[float]] = [record["embedding"]
|
||||||
|
for record in data]
|
||||||
|
|
||||||
collection.add(
|
collection.add(
|
||||||
ids=[str(uuid4()) for _ in data],
|
ids=[str(uuid4()) for _ in data],
|
||||||
|
|||||||
+2
-1
@@ -98,7 +98,8 @@ def add_data(
|
|||||||
],
|
],
|
||||||
file: Annotated[
|
file: Annotated[
|
||||||
str,
|
str,
|
||||||
typer.Argument(help="Path to the file to chunk and add to the collection."),
|
typer.Argument(
|
||||||
|
help="Path to the file to chunk and add to the collection."),
|
||||||
],
|
],
|
||||||
) -> None:
|
) -> None:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ def _parse_where_clause(where_clause: str) -> dict[str, str]:
|
|||||||
condition, separator, value = where_clause.partition("=")
|
condition, separator, value = where_clause.partition("=")
|
||||||
|
|
||||||
if separator == "":
|
if separator == "":
|
||||||
raise ValueError("Invalid --where value. Expected <condition>=<value>.")
|
raise ValueError(
|
||||||
|
"Invalid --where value. Expected <condition>=<value>.")
|
||||||
|
|
||||||
condition = condition.strip()
|
condition = condition.strip()
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
|
|
||||||
if not condition or not value:
|
if not condition or not value:
|
||||||
raise ValueError("Invalid --where value. Expected <condition>=<value>.")
|
raise ValueError(
|
||||||
|
"Invalid --where value. Expected <condition>=<value>.")
|
||||||
|
|
||||||
return {condition: value}
|
return {condition: value}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user