diff --git a/backend/open_webui/apps/rag/utils.py b/backend/open_webui/apps/rag/utils.py index 274a84c92..bdec5f9da 100644 --- a/backend/open_webui/apps/rag/utils.py +++ b/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 diff --git a/backend/open_webui/apps/rag/vector/dbs/chroma.py b/backend/open_webui/apps/rag/vector/dbs/chroma.py index 7927d9ad4..5f9420108 100644 --- a/backend/open_webui/apps/rag/vector/dbs/chroma.py +++ b/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"]], } diff --git a/backend/open_webui/apps/rag/vector/dbs/milvus.py b/backend/open_webui/apps/rag/vector/dbs/milvus.py index 6e98efeec..cdc8d0b08 100644 --- a/backend/open_webui/apps/rag/vector/dbs/milvus.py +++ b/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.