Skip to content

Commit

Permalink
Fix chromadb get_collection ignores custom embedding_function (#2854)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkall authored and victordibia committed Jul 30, 2024
1 parent 02c7806 commit f55a0c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autogen/agentchat/contrib/vectordb/chromadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_collection(
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:
Expand Down Expand Up @@ -126,7 +126,9 @@ def get_collection(self, collection_name: str = None) -> Collection:
)
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:
Expand Down

0 comments on commit f55a0c8

Please sign in to comment.