Trying to use Chroma vectorstore with default embedding_function results in an error #18291
Closed
5 tasks done
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
🔌: chroma
Primarily related to ChromaDB integrations
Ɑ: vector store
Related to vector store module
Checked other resources
Example Code
Using this code gives the first type of exception "You must provide an embedding function to compute embeddings."
If I pass the "embedding_function" to Chroma initialization - I get another error: "AttributeError: 'ONNXMiniLM_L6_V2' object has no attribute 'embed_query'"
Error Message and Stack Trace (if applicable)
Initial case when not providing any embedding_function to
langchain_community.vectorstores.Chroma
:Case when providing the default embedding_function to the Chroma initializer
Description
embedding_function
arg, or when I pass it explicitlyembedding_function=embedding_functions.DefaultEmbeddingFunction()
to the Chroma constructorretriever.invoke(text)
I've debugged and found out the problem is most likely in this line: https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/vectorstores/chroma.py#L128 line
If nothing was passed to the
embedding_function
- it would initialize normally and just query the chroma collection and inside the collection it will use the right methods for the embedding_function inside the chromadb lib source code:return self._embedding_function(input=input)
. At least it will work for the default embedding_function provided by chromadb. Please, fix it.System Info
System Information
Package Information
The text was updated successfully, but these errors were encountered: