> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Embedding Agent • AI Agent SDK

> EmbeddingAgent: A specialized agent for generating text embeddings.

# EmbeddingAgent

> Defined in the [**Embedding Agent**](../modules/embedding_agent) module.

<Badge color="blue">AI Agent</Badge>

A specialized agent for generating text embeddings.

Provides:

* Single text embedding
* Batch text embedding
* Similarity calculation between texts

Supported Providers:

* OpenAI: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`
* Azure: `azure/text-embedding-3-small`
* Cohere: `cohere/embed-english-v3.0`, `cohere/embed-multilingual-v3.0`
* Voyage: `voyage/voyage-3`, `voyage/voyage-3-lite`
* Mistral: `mistral/mistral-embed`

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: EmbeddingAgent"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Constructor

<ParamField query="name" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="instructions" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="llm" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="model" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="base_url" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="api_key" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="embedding" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="verbose" type="Union" required={false} default="True">
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="console()" icon="function" href="../functions/EmbeddingAgent-console">
    Lazily initialize Rich Console.
  </Card>

  <Card title="litellm()" icon="function" href="../functions/EmbeddingAgent-litellm">
    Lazy load litellm module when needed.
  </Card>

  <Card title="embed()" icon="function" href="../functions/EmbeddingAgent-embed">
    Generate embedding for a single text.
  </Card>

  <Card title="embed_batch()" icon="function" href="../functions/EmbeddingAgent-embed_batch">
    Generate embeddings for multiple texts.
  </Card>

  <Card title="similarity()" icon="function" href="../functions/EmbeddingAgent-similarity">
    Calculate cosine similarity between two texts.
  </Card>

  <Card title="find_most_similar()" icon="function" href="../functions/EmbeddingAgent-find_most_similar">
    Find the most similar texts to a query.
  </Card>

  <Card title="aembed()" icon="function" href="../functions/EmbeddingAgent-aembed">
    Async version of embed().
  </Card>

  <Card title="aembed_batch()" icon="function" href="../functions/EmbeddingAgent-aembed_batch">
    Async version of embed\_batch().
  </Card>

  <Card title="asimilarity()" icon="function" href="../functions/EmbeddingAgent-asimilarity">
    Async version of similarity().
  </Card>
</CardGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import EmbeddingAgent
    
    # Simple usage
    agent = EmbeddingAgent()
    embedding = agent.embed("Hello world")
    print(f"Embedding dimension: {len(embedding)}")
    
    # Batch embedding
    embeddings = agent.embed_batch([
        "First text",
        "Second text",
        "Third text"
    ])
    
    # Calculate similarity
    score = agent.similarity("Hello", "Hi there")
    print(f"Similarity: {score:.2f}")
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/embedding_agent.py#L48">
  `praisonaiagents/agent/embedding_agent.py` at line 48
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
