Skip to main content
This file contains the MistralEncoder class which is used to encode text using MistralAI

mistral_to_list

Convert a Mistral embedding response to a list of embeddings. Arguments:
  • embeds (EmbeddingResponse): The Mistral embedding response.
Returns: list[list[float]]: One embedding per input document.

MistralEncoder Objects

Class to encode text using MistralAI and SDK. Requires a MistralAI API key from https://console.mistral.ai/api-keys/

__init__

Initialize the MistralEncoder. Arguments:
  • name (str): The name of the embedding model to use such as “mistral-embed”.
  • mistralai_api_key (str): The MistralAI API key.
  • score_threshold: The score threshold for the embeddings.

__call__

Encode a list of text documents into embeddings using MistralAI. Arguments:
  • docs (list[Any]): List of text documents to encode.
Returns: list[list[float]]: List of embeddings for each document.

acall

Encode a list of text documents into embeddings using MistralAI asynchronously. Arguments:
  • docs (list[Any]): List of text documents to encode.
Returns: list[list[float]]: List of embeddings for each document.