mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: hybrid search
This commit is contained in:
parent
939bfd153e
commit
823093eea6
@ -97,8 +97,8 @@ def query_doc_with_hybrid_search(
|
|||||||
result = VECTOR_DB_CLIENT.get(collection_name=collection_name)
|
result = VECTOR_DB_CLIENT.get(collection_name=collection_name)
|
||||||
|
|
||||||
bm25_retriever = BM25Retriever.from_texts(
|
bm25_retriever = BM25Retriever.from_texts(
|
||||||
texts=result.documents,
|
texts=result.documents[0],
|
||||||
metadatas=result.metadatas,
|
metadatas=result.metadatas[0],
|
||||||
)
|
)
|
||||||
bm25_retriever.k = k
|
bm25_retriever.k = k
|
||||||
|
|
||||||
|
@ -70,13 +70,10 @@ class ChromaClient:
|
|||||||
# Get all the items in the collection.
|
# Get all the items in the collection.
|
||||||
collection = self.client.get_collection(name=collection_name)
|
collection = self.client.get_collection(name=collection_name)
|
||||||
if collection:
|
if collection:
|
||||||
|
|
||||||
result = collection.get()
|
result = collection.get()
|
||||||
|
|
||||||
return GetResult(
|
return GetResult(
|
||||||
**{
|
**{
|
||||||
"ids": [result["ids"]],
|
"ids": [result["ids"]],
|
||||||
"distances": [result["distances"]],
|
|
||||||
"documents": [result["documents"]],
|
"documents": [result["documents"]],
|
||||||
"metadatas": [result["metadatas"]],
|
"metadatas": [result["metadatas"]],
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class MilvusClient:
|
|||||||
collection_name=f"{self.collection_prefix}_{collection_name}",
|
collection_name=f"{self.collection_prefix}_{collection_name}",
|
||||||
filter='id != ""',
|
filter='id != ""',
|
||||||
)
|
)
|
||||||
return self._result_to_query_result(result)
|
return GetResult(**self._result_to_query_result(result))
|
||||||
|
|
||||||
def insert(self, collection_name: str, items: list[VectorItem]):
|
def insert(self, collection_name: str, items: list[VectorItem]):
|
||||||
# Insert the items into the collection, if the collection does not exist, it will be created.
|
# Insert the items into the collection, if the collection does not exist, it will be created.
|
||||||
|
Loading…
Reference in New Issue
Block a user