Description
Checked other resources
- I added a very descriptive title to this issue.
- I searched the LangChain documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
I am encountering the following error when trying to run the code using the HuggingFaceInstructEmbeddings from the langchain_community.embeddings module:
ImportError: Dependencies for InstructorEmbedding not found.
Code:
from langchain_community.embeddings import HuggingFaceInstructEmbeddings
# Pre-trained Embedding Model.
EMBEDDING_MODEL_NAME = "hkunlp/instructor-large"
#Embeddings
embeddings = HuggingFaceInstructEmbeddings(
model_name=EMBEDDING_MODEL_NAME,
embed_instruction="Represent the document for retrieval:",
query_instruction="Represent the question for retrieving supporting documents:"
)
Installed Dependency Versions:
langchain==0.3.21
langchain-core==0.3.49
langchain-community==0.3.20
sentence-transformers==2.2.2
InstructorEmbedding==1.0.1
Could you please assist in resolving this issue? If there are any compatibility updates or changes needed in the dependencies or usage, it would be great to have more insight.
Error Message and Stack Trace (if applicable)
No response
Description
Expected Behavior:
The HuggingFaceInstructEmbeddings object should initialize successfully, and the embedding model should be loaded for document and query retrieval.
System Info
System Information
OS: Linux
OS Version: #138-Ubuntu SMP Sat Nov 30 22:28:23 UTC 2024
Python Version: 3.10.12 (main, Jan 17 2025, 14:35:34) [GCC 11.4.0]
Package Information
langchain_core: 0.3.49
langchain: 0.3.21
langchain_community: 0.3.20
langsmith: 0.3.19
langchain_chroma: 0.2.2
langchain_groq: 0.3.1
langchain_huggingface: 0.1.2
langchain_text_splitters: 0.3.7