embed_texts

Function embed_texts 

Source
pub async fn embed_texts(
    _provider: &dyn EmbeddingProvider,
    config: &EmbeddingConfig,
    texts: &[String],
) -> Result<Vec<Vec<f32>>>
Expand description

Embed a batch of texts using the configured provider.

This is the main entry point for generating embeddings. It dispatches to the appropriate backend based on the config’s provider field.

§Arguments

  • _provider — Provider instance (used for metadata; dispatch is config-based).
  • config — Embedding configuration with provider, model, and retry settings.
  • texts — Batch of text strings to embed.

§Returns

A vector of embedding vectors, one per input text, in the same order.

§Errors

  • "disabled" provider: always returns an error.
  • "openai" provider: returns an error if the API key is missing, the API returns a non-retryable error, or all retries are exhausted.