> ## 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.

# HuggingFace Embeddings

> Generate embeddings using HuggingFace Inference API

## Overview

HuggingFace provides access to thousands of open-source embedding models through their Inference API.

## Quick Start

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import embedding

result = embedding(
    input="Hello world",
    model="huggingface/BAAI/bge-large-en-v1.5"
)
print(f"Dimensions: {len(result.embeddings[0])}")
```

## CLI Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai embed "Hello world" --model huggingface/BAAI/bge-large-en-v1.5
```

## Setup

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export HUGGINGFACE_API_KEY="hf_..."
```

## Popular Models

| Model                                                 | Dimensions | Use Case             |
| ----------------------------------------------------- | ---------- | -------------------- |
| `huggingface/BAAI/bge-large-en-v1.5`                  | 1024       | High quality English |
| `huggingface/BAAI/bge-base-en-v1.5`                   | 768        | Balanced             |
| `huggingface/BAAI/bge-small-en-v1.5`                  | 384        | Fast                 |
| `huggingface/sentence-transformers/all-MiniLM-L6-v2`  | 384        | Fast, general        |
| `huggingface/sentence-transformers/all-mpnet-base-v2` | 768        | High quality         |
| `huggingface/intfloat/e5-large-v2`                    | 1024       | E5 model             |

<Note>
  Model-name lookup in `get_dimensions()` is now case-insensitive **and** matches longest keys first as of [PraisonAI PR #3027](https://github.com/MervinPraison/PraisonAI/pull/3027):

  * `all-MiniLM-L6-v2` and `sentence-transformers/all-MiniLM-L6-v2` both resolve to `384` (was `1536`).
  * `voyage/voyage-3-lite` resolves to `512` (was `1024` — `voyage-3` was matching first).

  Earlier releases returned the wrong dimension for these names, producing dimension-mismatch errors on memory / RAG upsert.
</Note>

## Batch Embeddings

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import embedding

texts = ["Document 1", "Document 2", "Document 3"]
result = embedding(
    input=texts,
    model="huggingface/BAAI/bge-large-en-v1.5"
)
print(f"Generated {len(result.embeddings)} embeddings")
```

## Related

* [Embedding Providers Overview](/docs/embeddings/index)
* [Ollama Embeddings](/docs/embeddings/providers/ollama)
