LaserEmbeddings#
- class langchain_community.embeddings.laser.LaserEmbeddings[source]#
Bases:
BaseModel
,Embeddings
LASER Language-Agnostic SEntence Representations. LASER is a Python library developed by the Meta AI Research team and used for creating multilingual sentence embeddings for over 147 languages as of 2/25/2024 See more documentation at: * facebookresearch/LASER * facebookresearch/LASER * https://arxiv.org/abs/2205.12654
To use this class, you must install the laser_encoders Python package.
pip install laser_encoders .. rubric:: Example
from laser_encoders import LaserEncoderPipeline encoder = LaserEncoderPipeline(lang=βeng_Latnβ) embeddings = encoder.encode_sentences([βHelloβ, βWorldβ])
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param lang: str | None = None#
The language or language code youβd like to use If empty, this implementation will default to using a multilingual earlier LASER encoder model (called laser2) Find the list of supported languages at facebookresearch/flores
- async aembed_documents(texts: List[str]) List[List[float]] #
Asynchronous Embed search docs.
- Parameters:
texts (List[str]) β List of text to embed.
- Returns:
List of embeddings.
- Return type:
List[List[float]]
- async aembed_query(text: str) List[float] #
Asynchronous Embed query text.
- Parameters:
text (str) β Text to embed.
- Returns:
Embedding.
- Return type:
List[float]
Examples using LaserEmbeddings