Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

EdenAITextEmbedder

Embed a query string using Eden AI's multi-provider embedding API. Use this component in query pipelines to transform user queries into vectors for embedding-based retrieval.

Key Features​

  • Routes embedding requests through Eden AI to multiple providers—including OpenAI, Mistral, Cohere, and Google—using a single API key.
  • Uses Eden AI's provider/model naming convention, for example openai/text-embedding-3-small or mistral/mistral-embed.
  • Outputs a float vector embedding suitable for use with embedding retrievers.
  • Supports EU data residency through Eden AI's infrastructure.
  • The model must match the one used in the corresponding EdenAIDocumentEmbedder in the indexing pipeline.

Configuration​

  1. Drag the EdenAITextEmbedder component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab:
    1. Create a secret with your Eden AI API key. Use EDENAI_API_KEY as the secret key. For instructions, see Create Secrets. Get your API key from Eden AI.
    2. Set the model field to the same embedding model you used for indexing, in provider/model format, for example openai/text-embedding-3-small.
  4. Go to the Advanced tab to configure timeout and max_retries.

Connections​

EdenAITextEmbedder receives the user query as a text string through its text input, typically from the Input component. It outputs a float vector through its embedding output, which you connect to an embedding retriever such as OpenSearchEmbeddingRetriever.

Source Code​

To check this component's source code, open text_embedder.py in the Haystack Core Integrations repository.

Usage Examples​

Basic Configuration​

EdenAITextEmbedder:
type: haystack_integrations.components.embedders.edenai.text_embedder.EdenAITextEmbedder
init_parameters:
api_key:
type: env_var
env_vars:
- EDENAI_API_KEY
strict: false
model: openai/text-embedding-3-small
api_base_url: https://api.edenai.run/v3

Using the Component in a Pipeline​

This example shows a query pipeline with EdenAITextEmbedder that embeds the user query and sends it to OpenSearchEmbeddingRetriever to find matching documents.

# haystack-pipeline
components:
EdenAITextEmbedder:
type: haystack_integrations.components.embedders.edenai.text_embedder.EdenAITextEmbedder
init_parameters:
api_key:
type: env_var
env_vars:
- EDENAI_API_KEY
strict: false
model: openai/text-embedding-3-small
api_base_url: https://api.edenai.run/v3
prefix: ""
suffix: ""
OpenSearchEmbeddingRetriever:
type: haystack_integrations.components.retrievers.opensearch.embedding_retriever.OpenSearchEmbeddingRetriever
init_parameters:
filters:
top_k: 10
filter_policy: replace
custom_query:
raise_on_failure: true
efficient_filtering: true
document_store:
type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
init_parameters:
hosts:
index: Standard-Index-English
max_chunk_bytes: 104857600
embedding_dim: 1536
return_embedding: false
method:
mappings:
settings:
create_index: true
http_auth:
use_ssl:
verify_certs:
timeout:

connections:
- sender: EdenAITextEmbedder.embedding
receiver: OpenSearchEmbeddingRetriever.query_embedding

max_runs_per_component: 100

metadata: {}

inputs:
query:
- EdenAITextEmbedder.text

Parameters​

Inputs​

ParameterTypeDescription
textstrThe text to embed.

Outputs​

ParameterTypeDescription
embeddingList[float]The embedding of the input text.
metaDict[str, Any]Metadata about the request, including model name and usage statistics.

Init Parameters​

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
api_keySecretSecret.from_env_var('EDENAI_API_KEY')The Eden AI API key.
modelstropenai/text-embedding-3-smallThe Eden AI embedding model in provider/model format. For a full list, see the Eden AI models catalog.
api_base_urlOptional[str]https://api.edenai.run/v3The Eden AI API base URL.
prefixstr""A string to add to the beginning of the text.
suffixstr""A string to add to the end of the text.
timeoutOptional[float]NoneTimeout for API calls in seconds. Defaults to the OPENAI_TIMEOUT environment variable or 30 seconds.
max_retriesOptional[int]NoneMaximum number of retries after an internal error. Defaults to the OPENAI_MAX_RETRIES environment variable or 5.
http_client_kwargsOptional[Dict[str, Any]]NoneKeyword arguments for a custom httpx.Client or httpx.AsyncClient.

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.

ParameterTypeDescription
textstrThe text to embed.