Files
langchain/docs/modules/models/text_embedding/examples/instruct_embeddings.ipynb
2023-03-26 19:49:46 -07:00

1.9 KiB

InstructEmbeddings

Let's load the HuggingFace instruct Embeddings class.

In [8]:
from langchain.embeddings import HuggingFaceInstructEmbeddings
In [9]:
embeddings = HuggingFaceInstructEmbeddings(
    query_instruction="Represent the query for retrieval: "
)
load INSTRUCTOR_Transformer
max_seq_length  512
In [10]:
text = "This is a test document."
In [11]:
query_result = embeddings.embed_query(text)
In [ ]: