浏览代码

chromadb switch to cosine similarity

Jannik Streidl 6 月之前
父节点
当前提交
89c77f05a8
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      backend/open_webui/apps/retrieval/vector/dbs/chroma.py

+ 4 - 1
backend/open_webui/apps/retrieval/vector/dbs/chroma.py

@@ -109,7 +109,10 @@ class ChromaClient:
 
     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.
-        collection = self.client.get_or_create_collection(name=collection_name)
+        collection = self.client.get_or_create_collection(
+            name=collection_name,
+            metadata={"hnsw:space": "cosine"}
+            )
 
         ids = [item["id"] for item in items]
         documents = [item["text"] for item in items]