-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
ChromaDb EmbeddingFunction definition updated #13061
Comments
🤖 Hello @jayant-yadav, Nice to meet you! I'm here to assist you with your issues and questions related to the LangChain repository. I'm a bot created to provide immediate responses while you're waiting for a human maintainer. Please don't hesitate to ask me anything you need. Let's get started! Based on the error message you provided, it seems that the The To resolve this issue, you might need to update the def embed_documents(self, input: List[str]) -> List[List[float]]:
"""Compute doc embeddings using a HuggingFace transformer model.
Args:
input: The list of texts to embed.
Returns:
List of embeddings, one for each text.
"""
input = [t.replace("\n", " ") for t in input]
embeddings = self.client.encode(input, **self.encode_kwargs)
return embeddings.tolist()
def embed_query(self, input: str) -> List[float]:
"""Compute query embeddings using a HuggingFace transformer model.
Args:
input: The text to embed.
Returns:
Embeddings for the text.
"""
input = input.replace("\n", " ")
embedding = self.client.encode(
self.query_instruction + input, **self.encode_kwargs
)
return embedding.tolist() Please note that this is just a suggestion and might not fully resolve the issue. You might need to make additional changes to the SourcesThis 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. |
Quick work around until the HuggingFaceEmbeddings is updated. This breaking change affects chromadb 0.4.16 |
Langchain 0.0.332 released with the chroma team's fix for compatibility with chromadb>=0.4.16 Can now use latest of both |
Actually looks like there was something specific with |
@efriis The fix in 0.0.332 works! Now langchain's latest version (0.0.332) is compatible with chromadb==0.4.16. |
This is fixed now .. Thank you @efriis |
thanks this fixed my error! |
this change fixes this error that arises due to a code breaking change from chromadb: langchain-ai/langchain#13061
this change fixes this error that arises due to a code breaking change from chromadb: langchain-ai/langchain#13061 Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
this change fixes this error that arises due to a code breaking change from chromadb: langchain-ai/langchain#13061 Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
I am using chromadb-0.5.0 and langchain-0.2.1 and I still run into this error when I try to host ChromaDB using a docker container.
|
System Info
Using Google Colab Free version with T4 GPU.
chromadb==0.4.16
Who can help?
@agola11 @hwchase17
Information
Related Components
Reproduction
As per the latest Chromadb migration logs (link)
EmbeddingFunction
defnition has been updated and it affects all the custom made embedding function.What this means is the
langchain.embeddings.HuggingFaceBgeEmbeddings
is inconsistent with this new definition and throws the following error:The above code can be reproduced by inserting documents into Chromadb embedded using
HuggingFaceBgeEmbeddings
like so:I am not sure, but the answer might lie in correcting the
HuggingFaceBgeEmbeddings
class : link ?Expected behavior
The expected behaviour would have made a valid
db
object upon running the codeThe text was updated successfully, but these errors were encountered: