Browse Source

fix: hybrid search

Timothy J. Baek 7 months ago
parent
commit
823093eea6

+ 2 - 2
backend/open_webui/apps/rag/utils.py

@@ -97,8 +97,8 @@ def query_doc_with_hybrid_search(
         result = VECTOR_DB_CLIENT.get(collection_name=collection_name)
 
         bm25_retriever = BM25Retriever.from_texts(
-            texts=result.documents,
-            metadatas=result.metadatas,
+            texts=result.documents[0],
+            metadatas=result.metadatas[0],
         )
         bm25_retriever.k = k
 

+ 0 - 3
backend/open_webui/apps/rag/vector/dbs/chroma.py

@@ -70,13 +70,10 @@ class ChromaClient:
         # Get all the items in the collection.
         collection = self.client.get_collection(name=collection_name)
         if collection:
-
             result = collection.get()
-
             return GetResult(
                 **{
                     "ids": [result["ids"]],
-                    "distances": [result["distances"]],
                     "documents": [result["documents"]],
                     "metadatas": [result["metadatas"]],
                 }

+ 1 - 1
backend/open_webui/apps/rag/vector/dbs/milvus.py

@@ -113,7 +113,7 @@ class MilvusClient:
             collection_name=f"{self.collection_prefix}_{collection_name}",
             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]):
         # Insert the items into the collection, if the collection does not exist, it will be created.