Find answers from the community

Updated 2 years ago

Embeddings

At a glance

The community member is facing issues with custom embedding models, specifically with Instructor embedding models and Sentence Transformers, and is encountering various value errors. They are seeking a working notebook or code example that they can use.

In the comments, another community member suggests that when using embeddings from LangChain, the community member needs to wrap them with the LangchainEmbedding wrapper class. They provide an example code snippet for this. Another comment suggests that the community member can also run any embedding model locally from Huggingface, and provides a link to relevant documentation.

There is no explicitly marked answer in the comments.

Useful resources
Anyone facing problems with custom embedding models? I have tried instructor embedding models and now sentence transformers, but none of them worked properly, even if running example notebooks. I always get different kinds of value errors. Like: ValueError: "HuggingFaceHubEmbeddings" object has no field "callback_manager"
If you have a currently working notebook I would really appreciate the code.
L
2 comments
How are you creating the embeddings?

When you use embeddings from langchain, you need to wrap them with our wrapper class

Plain Text
from llama_index.embedding.langchain import LangchainEmbedding

embed_model = LangchainEmbedding(HuggingFaceHubEmbeddings(..))

service_context = ServiceContext.from_defaults(embed_model=embed_model, ...)
Add a reply
Sign up and join the conversation on Discord