Overview
Generate vector embeddings for text using various embedding models through LiteLLM. Supports 100+ embedding models including OpenAI, Cohere, HuggingFace, Azure, and more.Quick Start
Agent-Centric Usage
Embeddings are used internally by PraisonAI Agents for:- Knowledge retrieval (RAG) - semantic search over documents
- Memory storage - storing and retrieving conversation context
- Semantic similarity - finding related content
Agent with Knowledge (uses embeddings internally)
Agent with Memory (uses embeddings internally)
Direct Embedding API
Single Text Embedding
Batch Embeddings
Get Model Dimensions
With Custom Dimensions
Async Usage
Import Options
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
input | str or List[str] | Required | Text(s) to embed |
model | str | ”text-embedding-3-small” | Embedding model |
dimensions | int | None | Output dimensions |
encoding_format | str | ”float" | "float” or “base64” |
timeout | float | 600.0 | Request timeout |
api_key | str | None | API key override |
Result Object
TheEmbeddingResult object contains:
embeddings: List of embedding vectorsmodel: Model usedusage: Token usage statistics
Supported Models
Since PraisonAI wraps LiteLLM, all LiteLLM-supported embedding models work:- OpenAI:
text-embedding-3-small,text-embedding-3-large,text-embedding-ada-002 - Cohere:
cohere/embed-english-v3.0,cohere/embed-multilingual-v3.0 - Azure:
azure/text-embedding-ada-002 - HuggingFace:
huggingface/sentence-transformers/all-MiniLM-L6-v2 - Voyage:
voyage/voyage-01,voyage/voyage-lite-01 - And many more via LiteLLM

