Prerequisites
Install the Tracia SDK:.env
The Python SDK uses LiteLLM under the hood. LiteLLM is included as a dependency and handles all provider communication.
Single Text Embedding
Pass a string toinput to embed a single piece of text:
Batch Embedding
Pass a list of strings to embed multiple texts in a single request:Batch embedding is more efficient than making separate requests for each text. The provider processes all inputs in a single API call.
Specifying Dimensions
Some models support reducing the embedding dimensions. This is useful for saving storage space or improving retrieval speed:Using with Sessions
Sessions automatically chain embedding spans with other spans under the same trace:trace_id and parent_span_id automatically, so all spans appear in sequence in the Tracia dashboard.
With Tracing Metadata
Add tags and user identifiers for filtering in the Tracia dashboard:Without Tracing
Disable tracing when you don’t need observability:Async Usage
Usearun_embedding() for async contexts:

