Files
litellm/docs/extras/integrations/text_embedding/instruct_embeddings.ipynb
T
2023-07-29 07:12:19 -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 [ ]: