mirror of
https://github.com/open-webui/open-webui.git
synced 2026-04-30 11:27:08 +02:00
refac
This commit is contained in:
@@ -68,19 +68,18 @@ class ChromaClient:
|
||||
|
||||
def query(
|
||||
self, collection_name: str, filter: dict, limit: int = 1
|
||||
) -> Optional[SearchResult]:
|
||||
) -> Optional[GetResult]:
|
||||
# Query the items from the collection based on the filter.
|
||||
collection = self.client.get_collection(name=collection_name)
|
||||
if collection:
|
||||
result = collection.query(
|
||||
result = collection.get(
|
||||
where=filter,
|
||||
n_results=limit,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
return SearchResult(
|
||||
return GetResult(
|
||||
**{
|
||||
"ids": result["ids"],
|
||||
"distances": result["distances"],
|
||||
"documents": result["documents"],
|
||||
"metadatas": result["metadatas"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user