MistralDocumentEmbedder
A component for computing Document embeddings using Mistral models.
Basic Information
- Type:
haystack_integrations.components.embedders.mistral.document_embedder.MistralDocumentEmbedder
Inputs
| Parameter | Type | Default | Description |
|---|
Outputs
| Parameter | Type | Default | Description |
|---|
Overview
Work in Progress
Bear with us while we're working on adding pipeline examples and most common components connections.
A component for computing Document embeddings using Mistral models.
The embedding of each Document is stored in the embedding field of the Document.
Usage example:
from haystack import Document
from haystack_integrations.components.embedders.mistral import MistralDocumentEmbedder
doc = Document(content="I love pizza!")
document_embedder = MistralDocumentEmbedder()
result = document_embedder.run([doc])
print(result['documents'][0].embedding)
# [0.017020374536514282, -0.023255806416273117, ...]
Usage Example
components:
MistralDocumentEmbedder:
type: mistral.src.haystack_integrations.components.embedders.mistral.document_embedder.MistralDocumentEmbedder
init_parameters:
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| api_key | Secret | Secret.from_env_var('MISTRAL_API_KEY') | The Mistral API key. |
| model | str | mistral-embed | The name of the model to use. |
| api_base_url | Optional[str] | https://api.mistral.ai/v1 | The Mistral API Base url. For more details, see Mistral docs. |
| prefix | str | A string to add to the beginning of each text. | |
| suffix | str | A string to add to the end of each text. | |
| batch_size | int | 32 | Number of Documents to encode at once. |
| progress_bar | bool | True | Whether to show a progress bar or not. Can be helpful to disable in production deployments to keep the logs clean. |
| meta_fields_to_embed | Optional[List[str]] | None | List of meta fields that should be embedded along with the Document text. |
| embedding_separator | str | \n | Separator used to concatenate the meta fields to the Document text. |
| timeout | Optional[float] | None | Timeout for Mistral client calls. If not set, it defaults to either the OPENAI_TIMEOUT environment variable, or 30 seconds. |
| max_retries | Optional[int] | None | Maximum 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_kwargs | Optional[Dict[str, Any]] | None | A 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.
| Parameter | Type | Default | Description |
|---|
Was this page helpful?