跳到主要內容

Hugging Face 上的 Instruct Embeddings

Hugging Face sentence-transformers 是一個 Python 框架,用於最先進的句子、文本和圖像嵌入。 其中一個 instruct 嵌入模型用於 HuggingFaceInstructEmbeddings 類別中。

from langchain_community.embeddings import HuggingFaceInstructEmbeddings
embeddings = HuggingFaceInstructEmbeddings(
query_instruction="Represent the query for retrieval: "
)
load INSTRUCTOR_Transformer
max_seq_length 512
text = "This is a test document."
query_result = embeddings.embed_query(text)

此頁面是否有幫助? (Was this page helpful?)