HuggingFaceEmbeddings(
self,
**kwargs: Any = {},
)Keyword arguments to pass to the Sentence Transformer model, such as device,
prompts, default_prompt_name, revision, trust_remote_code, or token.
See also the Sentence Transformer documentation: https://sbert.net/docs/package_reference/SentenceTransformer.html#sentence_transformers.SentenceTransformer
Keyword arguments to pass when calling the encode method for the documents of
the Sentence Transformer model, such as prompt_name, prompt, batch_size,
precision, normalize_embeddings, and more.
See also the Sentence Transformer documentation: https://sbert.net/docs/package_reference/SentenceTransformer.html#sentence_transformers.SentenceTransformer.encode
Keyword arguments to pass when calling the encode method for the query of
the Sentence Transformer model, such as prompt_name, prompt, batch_size,
precision, normalize_embeddings, and more.
See also the Sentence Transformer documentation: https://sbert.net/docs/package_reference/SentenceTransformer.html#sentence_transformers.SentenceTransformer.encode
HuggingFace sentence_transformers embedding models.
To use, you should have the sentence_transformers python package installed.
Example:
from langchain_huggingface import HuggingFaceEmbeddings
model_name = "sentence-transformers/all-mpnet-base-v2"
model_kwargs = {"device": "cpu"}
encode_kwargs = {"normalize_embeddings": False}
hf = HuggingFaceEmbeddings(
model_name=model_name,
model_kwargs=model_kwargs,
encode_kwargs=encode_kwargs,
)