From 9f077270c8a27bdfd8967d8db2db0e0ffbf4eced Mon Sep 17 00:00:00 2001 From: Anton Troynikov Date: Wed, 8 Nov 2023 12:55:35 -0800 Subject: [PATCH] Don't pass EF to chroma (#13085) - **Description:** Recently Chroma rolled out a breaking change on the way we handle embedding functions, in order to support multi-modal collections. This broke the way LangChain's `Chroma` objects get created, because we were passing the EF down into the Chroma collection: https://docs.trychroma.com/migration#migration-to-0416---november-7-2023 However, internally, we are never actually using embeddings on the chroma collection - LangChain's `Chroma` object calls it instead. Thus we just don't pass an `embedding_function` to Chroma itself, which fixes the issue. --- libs/langchain/langchain/vectorstores/chroma.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/langchain/langchain/vectorstores/chroma.py b/libs/langchain/langchain/vectorstores/chroma.py index 86bd274db..650b454e6 100644 --- a/libs/langchain/langchain/vectorstores/chroma.py +++ b/libs/langchain/langchain/vectorstores/chroma.py @@ -124,9 +124,7 @@ class Chroma(VectorStore): self._embedding_function = embedding_function self._collection = self._client.get_or_create_collection( name=collection_name, - embedding_function=self._embedding_function.embed_documents - if self._embedding_function is not None - else None, + embedding_function=None, metadata=collection_metadata, ) self.override_relevance_score_fn = relevance_score_fn