-
Notifications
You must be signed in to change notification settings - Fork 16.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
langchain.vectorstores.Chroma support for EmbeddingFunction.__call__ update of ChromaDB #13441
Comments
🤖 Hello @Mshardul, Nice to meet you! I'm a bot designed to assist with issues, answer questions, and help you become a contributor to the LangChain project. While we wait for a human maintainer to join us, I'm here to start the troubleshooting process with you. Please hold tight while I take a look at your issue and come up with a detailed response. |
🤖 The error you're encountering is likely due to a recent change in the ChromaDB library. The Based on the similar issues found in the LangChain repository, there are a few potential solutions:
Unfortunately, without the exact source code of Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
@Mshardul What is your python version? |
These version combinations worked for me. !pip install langchain==0.0.316 |
Issue Resolution: Embedding Function Override for GPT4All/OpenAi with Chroma Update Compatibility Hello, I noticed your query about an issue with OpenAIEmbedding and wanted to share my solution, as I faced a similar problem with GPT4All. The root of the issue lies in the incompatibility between Langchain's embedding function implementation and the new requirements introduced by Chroma's latest update. Problem Identified:
Relevant Documentation and Source Code:
Solution Implemented: Here's a snippet of the custom class implementation: class CustomEmbeddingFunction(ExistingEmbeddingFunction):
def __init__(self):
super().__init__()
def _existing_document_encoding_method(self, texts: List[str]) -> List[List[float]]:
"""
Embed a list of documents using the EmbeddingModel.
Args:
texts: List of texts to embed.
Returns:
List of embeddings, one for each text.
"""
embeddings = [self.client.embed(str(text)) for text in texts]
return [list(map(float, e)) for e in embeddings]
def __call__(self, input: List[str]) -> Embeddings:
return self._embed_documents(input) I hope this solution works for you as well. |
+1 would be great to have a fix on that |
System Info
This was working fine for my previous configuration,
langchain v0.0.225
chromadb v0.4.7
But now neither this is working, nor the latest version of both
langchain v0.0.336
chromadb v0.4.17
Who can help?
No response
Information
Related Components
Reproduction
I have the packages installed
Running these pieces of code
OR
Here is the error
Expected behavior
Earlier a chromadb instance would be created, and I would be able to query it with my prompts. That is the expected behaviour.
The text was updated successfully, but these errors were encountered: