Model2vecEmbeddings#
- class langchain_community.embeddings.model2vec.Model2vecEmbeddings(model: str)[source]#
Model2Vec embedding models.
Install model2vec first, run ‘pip install -U model2vec’. The github repository for model2vec is : MinishLab/model2vec
Example
from langchain_community.embeddings import Model2vecEmbeddings embedding = Model2vecEmbeddings("minishlab/potion-base-8M") embedding.embed_documents([ "It's dangerous to go alone!", "It's a secret to everybody.", ]) embedding.embed_query( "Take this with you." )
Initialize embeddings.
- Parameters:
model (str) – Model name.
Methods
__init__
(model)Initialize embeddings.
aembed_documents
(texts)Asynchronous Embed search docs.
aembed_query
(text)Asynchronous Embed query text.
embed_documents
(texts)Embed documents using the model2vec embeddings model.
embed_query
(text)Embed a query using the model2vec embeddings model.
- 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]