MiniMaxEmbeddings#
- class langchain_community.embeddings.minimax.MiniMaxEmbeddings[source]#
Bases:
BaseModel
,Embeddings
MiniMax embedding model integration.
- Setup:
To use, you should have the environment variable
MINIMAX_GROUP_ID
andMINIMAX_API_KEY
set with your API token.export MINIMAX_API_KEY="your-api-key" export MINIMAX_GROUP_ID="your-group-id"
- Key init args — completion params:
- model: Optional[str]
Name of ZhipuAI model to use.
- api_key: Optional[str]
Automatically inferred from env var MINIMAX_GROUP_ID if not provided.
- group_id: Optional[str]
Automatically inferred from env var MINIMAX_GROUP_ID if not provided.
See full list of supported init args and their descriptions in the params section.
Instantiate:
from langchain_community.embeddings import MiniMaxEmbeddings embed = MiniMaxEmbeddings( model="embo-01", # api_key="...", # group_id="...", # other )
- Embed single text:
input_text = "The meaning of life is 42" embed.embed_query(input_text)
[0.03016241, 0.03617699, 0.0017198119, -0.002061239, -0.00029994643, -0.0061320597, -0.0043635326, ...]
- Embed multiple text:
input_texts = ["This is a test query1.", "This is a test query2."] embed.embed_documents(input_texts)
[ [-0.0021588828, -0.007608119, 0.029349545, -0.0038194496, 0.008031177, -0.004529633, -0.020150753, ...], [ -0.00023150232, -0.011122423, 0.016930554, 0.0083089275, 0.012633711, 0.019683322, -0.005971041, ...] ]
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 embed_type_db: str = 'db'#
For embed_documents
- param embed_type_query: str = 'query'#
For embed_query
- param endpoint_url: str = 'https://api.minimax.chat/v1/embeddings'#
Endpoint URL to use.
- param minimax_api_key: SecretStr | None = None (alias 'api_key')#
API Key for MiniMax API.
- Constraints:
type = string
writeOnly = True
format = password
- param minimax_group_id: str | None = None (alias 'group_id')#
Group ID for MiniMax API.
- param model: str = 'embo-01'#
Embeddings model name to use.
- 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]
- embed(texts: List[str], embed_type: str) List[List[float]] [source]#
- Parameters:
texts (List[str]) –
embed_type (str) –
- Return type:
List[List[float]]
Examples using MiniMaxEmbeddings