Skip to main content

MistralTextEmbedder

A component for embedding strings using Mistral models.

Basic Information

  • Type: haystack_integrations.components.embedders.mistral.text_embedder.MistralTextEmbedder

Inputs

ParameterTypeDefaultDescription

Outputs

ParameterTypeDefaultDescription

Overview

Work in Progress

Bear with us while we're working on adding pipeline examples and most common components connections.

A component for embedding strings using Mistral models.

Usage example:

from haystack_integrations.components.embedders.mistral.text_embedder import MistralTextEmbedder

text_to_embed = "I love pizza!"
text_embedder = MistralTextEmbedder()
print(text_embedder.run(text_to_embed))

# output:
# {'embedding': [0.017020374536514282, -0.023255806416273117, ...],
# 'meta': {'model': 'mistral-embed',
# 'usage': {'prompt_tokens': 4, 'total_tokens': 4}}}

Usage Example

components:
MistralTextEmbedder:
type: mistral.src.haystack_integrations.components.embedders.mistral.text_embedder.MistralTextEmbedder
init_parameters:

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
api_keySecretSecret.from_env_var('MISTRAL_API_KEY')The Mistral API key.
modelstrmistral-embedThe name of the Mistral embedding model to be used.
api_base_urlOptional[str]https://api.mistral.ai/v1The Mistral API Base url. For more details, see Mistral docs.
prefixstrA string to add to the beginning of each text.
suffixstrA string to add to the end of each text.
timeoutOptional[float]NoneTimeout for Mistral client calls. If not set, it defaults to either the OPENAI_TIMEOUT environment variable, or 30 seconds.
max_retriesOptional[int]NoneMaximum number of retries to contact Mistral after an internal error. If not set, it defaults to either the OPENAI_MAX_RETRIES environment variable, or set to 5.
http_client_kwargsOptional[Dict[str, Any]]NoneA dictionary of keyword arguments to configure a custom httpx.Clientor httpx.AsyncClient. For more information, see the HTTPX documentation.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription