Fix chromadb get_collection ignores custom embedding_function (#2854)

This commit is contained in:
Li Jiang
2024-06-04 02:12:03 +08:00
committed by GitHub
parent 1e5c03f66a
commit 2000d47406

View File

@@ -83,7 +83,7 @@ class ChromaVectorDB(VectorDB):
if self.active_collection and self.active_collection.name == collection_name:
collection = self.active_collection
else:
collection = self.client.get_collection(collection_name)
collection = self.client.get_collection(collection_name, embedding_function=self.embedding_function)
except ValueError:
collection = None
if collection is None:
@@ -126,7 +126,9 @@ class ChromaVectorDB(VectorDB):
)
else:
if not (self.active_collection and self.active_collection.name == collection_name):
self.active_collection = self.client.get_collection(collection_name)
self.active_collection = self.client.get_collection(
collection_name, embedding_function=self.embedding_function
)
return self.active_collection
def delete_collection(self, collection_name: str) -> None: