Skip to main content

Embedding Module

Generate text embeddings with a simple API. Abstracts away the underlying provider (litellm) - users only need praisonai.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)

Returns: EmbeddingResult with:
  • embeddings: List of embedding vectors
  • model: Model used
  • usage: Token usage statistics

Supported Providers

Any provider supported by litellm embeddings:

Use Cases

Duplicate Detection

RAG Pipeline

Performance

Performance Tip: Pass lists to embed() instead of calling it in a loop. This batches requests into a single API call.

Error Handling

Environment Variables