embed_text

Function embed_text 

Source
pub async fn embed_text(
    text: &str,
    provider: Option<EmbeddingProvider>,
    api_key: Option<&str>,
) -> Result<Vec<f32>>
Expand description

Embed a single text string

Uses local embeddings by default (no API required). Set AVOCADODB_EMBEDDING_PROVIDER=openai to use OpenAI.

§Arguments

  • text - The text to embed
  • provider - Embedding provider (defaults to Local)
  • api_key - OpenAI API key (only used if provider is OpenAI)

§Returns

A vector of floats representing the embedding (384 for local, 1536 for OpenAI)