Skip to main content
The run_embedding() method generates text embeddings using OpenAI, Google, or Amazon Bedrock embedding models. Like run_local(), embedding requests go directly to the provider via LiteLLM and traces are sent to Tracia asynchronously in the background.

How It Works

When you call run_embedding(), the SDK:
  1. Calls the provider via LiteLLM - Your embedding request goes to OpenAI, Google, or Amazon Bedrock through LiteLLM. Tracia is not in the request path.
  2. Sends the trace asynchronously - After the provider responds, trace data is sent to Tracia in the background. This is non-blocking and adds zero latency to your application.
Embedding spans appear in the Tracia dashboard with the EMBEDDING span kind, so you can track embedding usage, latency, and costs alongside your LLM completions.

Quick Examples

Async Variant

Use arun_embedding() for async code:

Available Pages

Basic Usage

Single and batch embeddings, dimensions, sessions

Supported Models

OpenAI, Google, and Amazon Bedrock embedding models

Types

RunEmbeddingInput

RunEmbeddingResult

EmbeddingVector

EmbeddingUsage