|
@@ -68,19 +68,18 @@ class ChromaClient:
|
|
|
|
|
|
def query(
|
|
def query(
|
|
self, collection_name: str, filter: dict, limit: int = 1
|
|
self, collection_name: str, filter: dict, limit: int = 1
|
|
- ) -> Optional[SearchResult]:
|
|
|
|
|
|
+ ) -> Optional[GetResult]:
|
|
# Query the items from the collection based on the filter.
|
|
# Query the items from the collection based on the filter.
|
|
collection = self.client.get_collection(name=collection_name)
|
|
collection = self.client.get_collection(name=collection_name)
|
|
if collection:
|
|
if collection:
|
|
- result = collection.query(
|
|
|
|
|
|
+ result = collection.get(
|
|
where=filter,
|
|
where=filter,
|
|
- n_results=limit,
|
|
|
|
|
|
+ limit=limit,
|
|
)
|
|
)
|
|
|
|
|
|
- return SearchResult(
|
|
|
|
|
|
+ return GetResult(
|
|
**{
|
|
**{
|
|
"ids": result["ids"],
|
|
"ids": result["ids"],
|
|
- "distances": result["distances"],
|
|
|
|
"documents": result["documents"],
|
|
"documents": result["documents"],
|
|
"metadatas": result["metadatas"],
|
|
"metadatas": result["metadatas"],
|
|
}
|
|
}
|