Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Embedding Module
Generate text embeddings with a simple API. Abstracts away the underlying provider (litellm) - users only needpraisonai.embed() or praisonai.embedding().
Both
embed and embedding work identically - use whichever you prefer. The embedding alias is provided for LiteLLM naming consistency.Quick Start
Installation
The
[llm] extra is required for embedding support. It includes litellm for multi-provider compatibility.Usage Examples
Single Text
Multiple Texts
Custom Model
Import Options
API Reference
embed(input, model, **kwargs) / embedding(input, model, **kwargs)
| Parameter | Type | Default | Description |
|---|---|---|---|
input | str or List[str] | Required | Text(s) to embed |
model | str | "text-embedding-3-small" | Embedding model name |
dimensions | int | None | Output dimensions (if supported) |
encoding_format | str | "float" | ”float” or “base64” |
timeout | float | 600.0 | Request timeout |
api_key | str | None | API key override |
EmbeddingResult with:
embeddings: List of embedding vectorsmodel: Model usedusage: Token usage statistics
Supported Providers
Any provider supported by litellm embeddings:| Provider | Model Example |
|---|---|
| OpenAI | text-embedding-3-small, text-embedding-3-large |
| Azure | azure/text-embedding-ada-002 |
| Cohere | embed-english-v3.0 |
| Voyage | voyage-02 |
gemini/text-embedding-004 | |
| Bedrock | amazon.titan-embed-text-v1 |
Use Cases
Semantic Search
Duplicate Detection
RAG Pipeline
Performance
| Aspect | Value |
|---|---|
| Import overhead | 0ms (lazy loaded) |
| First call | ~200ms (loads litellm) |
| Subsequent calls | ~100ms |
| Batch efficiency | Single API call for lists |
Error Handling
Environment Variables
| Variable | Description |
|---|---|
OPENAI_API_KEY | Required for OpenAI models |
AZURE_API_KEY | For Azure OpenAI |
COHERE_API_KEY | For Cohere models |
GOOGLE_API_KEY | For Gemini models |
Related
- Embeddings Capability - Full embeddings documentation
- Embeddings CLI - CLI commands
- Vector Store Module - Store and query embeddings
- Knowledge Module - RAG with embeddings
- Memory Module - Agent memory with embeddings

