Quick Start
1
Simple Usage
Direct Embedding API
For more control, use the embedding functions directly:Embedding Models
OpenAI Models
Google Models
Cohere Models
Integration with Knowledge Base
Use embeddings with the KnowledgeBase for semantic search:Integration with Memory
Use embeddings for semantic memory search:Backend Selection
PraisonAI automatically selects the best backend:- AI SDK (preferred): When
aipackage is installed - Native: Falls back to direct OpenAI client
Force Backend
Environment Variable
Similarity Functions
Built-in similarity functions for comparing embeddings:Performance Tips
- Batch embeddings: Use
embedManyfor multiple texts - Cache embeddings: Store embeddings to avoid re-computation
- Choose model wisely:
text-embedding-3-smallis fast and cheap
Error Handling
TypeScript Types
Related
Embeddings CLI
Embeddings CLI overview
Knowledge Base
Knowledge Base overview

