Auto-selection with llm="local"
Since PR #4870, Agent(llm="local", memory=..., knowledge=[...]) auto-configures a local embedder — no embedder block needed.
- Resolves a running local server (Ollama, llama.cpp, LM Studio, vLLM).
- Picks an embedding-capable model from the server’s listing (preferring
nomic-embed-text, thenmxbai-embed-large,bge-m3,snowflake-arctic-embed,all-minilm). Fourteen locally-served embedders now carry measured dimensions — see Vector store is now sized correctly. - Sets the embedder to point at the same local server.
PRAISONAI_LOCAL_EMBED_MODEL=<name> (accepts a bare name like all-minilm or the tagged id all-minilm:latest).
If the local server serves no embedding model, the agent logs a warning and does not silently fall back to a remote provider — pull one (ollama pull nomic-embed-text) or configure the block manually below.
An explicitly configured embedder always wins — auto-selection only fills a gap.
Quick Start
1
Pull the embedder
2
Local memory
The
embedder block below is only needed when the LLM is not "local", or when you want to override the auto-selected model.3
Add local knowledge
The
embedder block below is only needed when the LLM is not "local", or when you want to override the auto-selected model.Install the MongoDB extra first:
pip install "praisonaiagents[mongodb]". Chroma is the default local vector store and needs no extra service.How It Works
The sameembedder block drives memory and knowledge — embed, store, and query all stay on your machine.
The SDK now sizes the vector index at the model’s real dimension — nomic-embed-text is 768, not the 1536 default it was silently written as before PR #4802.
Vector store is now sized correctly
Since PR #4924, the local embedder config carriesembedding_dims all the way to the vector store — sourced from the running server first (via /api/show), then from PraisonAI’s dimension table, and omitted rather than guessed when unknown.
A guessed width is worse than none: an index built at the wrong width either rejects every write or silently returns stale nearest neighbours. Before the fix, a store built for bge-m3 (1024) was silently sized at 1536 — every write to a fresh Chroma collection failed.
Measured widths for locally-served embedders:
The mem0 provider config for a local embedder now carries
embedding_dims alongside model:
Choosing a Local Embedder
Pick by what matters most: speed, balance, or quality.Common Patterns
Local memory with a local LLM:Knowledge class:
Best Practices
Re-create the vector index when you change the embedder
Re-create the vector index when you change the embedder
Atlas vector indexes are built for a fixed dimension. Moving from
text-embedding-3-small (1536) to nomic-embed-text (768) means dropping and re-creating vector_index at the new size — otherwise writes succeed but searches error or return nothing.Pull the embedder before running
Pull the embedder before running
The first embed call fails cold if the model isn’t downloaded. Run
ollama pull nomic-embed-text before starting the agent.Set api_base when Ollama isn't on localhost
Set api_base when Ollama isn't on localhost
Ollama defaults to
http://localhost:11434. Point elsewhere by setting api_base explicitly on the embedder call or OLLAMA_HOST in the environment.Prefer the embedder block form
Prefer the embedder block form
The
{"provider": "...", "config": {"model": "..."}} block works identically across memory, knowledge, and the MongoDB adapters — reuse one dict everywhere.Related
MongoDB Memory
Configure the embedder on the MongoDB memory store
MongoDB Knowledge
Scoped, vector-searchable knowledge in MongoDB
Ollama Embeddings
Local embedding models and auto-detected dimensions
Local Models
Run the LLM side fully local

