Hugging Face sentence-transformers is a Python framework for state-of-the-art sentence, text and image embeddings.
One of the instruct embedding models is used in the HuggingFaceInstructEmbeddings class.
Copy
Ask AI
from langchain_community.embeddings import HuggingFaceInstructEmbeddings
Copy
Ask AI
embeddings = HuggingFaceInstructEmbeddings( query_instruction="Represent the query for retrieval: ")
Copy
Ask AI
load INSTRUCTOR_Transformermax_seq_length 512
Copy
Ask AI
text = "This is a test document."
Copy
Ask AI
query_result = embeddings.embed_query(text)
Assistant
Responses are generated using AI and may contain mistakes.