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

# Ollama Embeddings

> Generate embeddings using locally-hosted Ollama models

## Overview

Ollama allows you to run embedding models locally on your machine with no API costs.

## Quick Start

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

result = embedding(
    input="Hello world",
    model="ollama/nomic-embed-text"
)
print(f"Dimensions: {len(result.embeddings[0])}")
```

## CLI Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai embed "Hello world" --model ollama/nomic-embed-text
```

## Setup

1. Install Ollama: [https://ollama.ai](https://ollama.ai)
2. Pull an embedding model:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
ollama pull nomic-embed-text
```

## Available Models

| Model                           | Dimensions        | Size  |
| ------------------------------- | ----------------- | ----- |
| `ollama/nomic-embed-text`       | 768               | 274MB |
| `ollama/mxbai-embed-large`      | 1024              | 669MB |
| `ollama/all-minilm`             | 384               | 45MB  |
| `ollama/snowflake-arctic-embed` | not auto-detected | 669MB |

<Note>
  **Dimensions are auto-detected.** As of [PR #4802](https://github.com/MervinPraison/PraisonAI/pull/4802) PraisonAI resolves Ollama model dimensions automatically — `nomic-embed-text` → 768, `all-minilm` → 384, `mxbai-embed-large` → 1024. Provider prefixes and version tags (`ollama/nomic-embed-text:v1.5`) are stripped before lookup, so they size the same as the bare tag. Vector stores built through PraisonAI size their indexes to match the model.
</Note>

<Warning>
  `snowflake-arctic-embed` is **not** in the auto-detection table (its dimension was not measured on hardware). It falls back to the `1536` default — set the dimension explicitly on your vector store if you use it.
</Warning>

## Custom API Base

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

result = embedding(
    input="Hello world",
    model="ollama/nomic-embed-text",
    api_base="http://localhost:11434"
)
```

## 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="ollama/nomic-embed-text"
)
print(f"Generated {len(result.embeddings)} embeddings")
```

## Using Ollama embeddings for memory / knowledge

Point agent memory or knowledge at a local Ollama embedder with the same `embedder` block used across PraisonAI:

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

agent = Agent(
    name="assistant",
    memory={
        "provider": "mongodb",
        "config": {
            "connection_string": "mongodb://localhost:27017/",
            "database": "praisonai",
            "use_vector_search": True,
            "embedder": {
                "provider": "ollama",
                "config": {"model": "nomic-embed-text"},
            },
        },
    },
)
```

See [MongoDB Memory](/docs/features/mongodb-memory) and [MongoDB Knowledge](/docs/features/mongodb-knowledge) for the full setup, or [Local Memory & Knowledge](/docs/features/local-memory-and-knowledge) to wire both fully local end to end.

## Related

* [Embedding Providers Overview](/docs/embeddings/index)
* [HuggingFace Embeddings](/docs/embeddings/providers/huggingface)
* [MongoDB Memory](/docs/features/mongodb-memory)
* [MongoDB Knowledge](/docs/features/mongodb-knowledge)
* [Local Memory & Knowledge](/docs/features/local-memory-and-knowledge)
