Summary
The Braintrust Rust SDK has no embeddings-specific instrumentation, while both the Braintrust Python SDK (EmbeddingV1Wrapper in py/src/braintrust/oai.py) and TypeScript SDK (wrapEmbeddings via openAIChannels.embeddingsCreate in js/src/wrappers/oai.ts) automatically instrument OpenAI embeddings.create() calls.
What is missing
-
No embeddings usage extractor — The existing extract_openai_usage() function in src/extractors.rs handles chat completion responses but is not tested or documented for embeddings responses. OpenAI embeddings responses have a different usage shape (prompt_tokens + total_tokens, no completion_tokens) and the extractor may produce misleading metrics (e.g. total_tokens fallback computation requires both prompt_tokens and completion_tokens).
-
No embeddings span helper — There is no helper analogous to wrap_stream_with_span (in src/stream.rs) for embeddings calls. The Python SDK's EmbeddingV1Wrapper and TypeScript SDK's wrapEmbeddings automatically capture embedding model, input text, dimensions, and token usage in traced spans. The Rust SDK provides no equivalent.
-
No embeddings response types — The src/stream.rs output types (FinalizedStream, OutputChoice, ChatMessage) are all chat-completion-specific. There are no types for representing embeddings responses (vectors, dimensions, encoding format).
Why this matters
Embeddings are a core AI execution surface. Users building RAG applications, semantic search, or similarity-based evaluation in Rust cannot get automatic instrumentation for their embedding calls through this SDK, unlike users of the Python or TypeScript SDKs.
Braintrust docs status
supported — The Braintrust proxy routes /embeddings requests and supports caching them (proxy docs). The OpenAI integration docs state "All API calls are automatically logged" when using the wrapper, though embeddings are not explicitly called out. The Python and TypeScript SDKs both implement embeddings wrapping.
Upstream sources
Local files inspected
src/extractors.rs — extract_openai_usage() and extract_anthropic_usage() handle chat completion usage; no embeddings-specific extraction or tests
src/stream.rs — BraintrustStream, FinalizedStream, OutputChoice, ChatMessage are all chat-completion-specific; no embeddings types
src/types.rs — UsageMetrics struct has no embeddings-specific fields
src/lib.rs — public API exports; no embeddings references
Cargo.toml — no embeddings-related dependencies
tests/ — no embeddings test scenarios
- Full codebase search for "embedding", "embed" — zero results in instrumentation code
Summary
The Braintrust Rust SDK has no embeddings-specific instrumentation, while both the Braintrust Python SDK (
EmbeddingV1Wrapperinpy/src/braintrust/oai.py) and TypeScript SDK (wrapEmbeddingsviaopenAIChannels.embeddingsCreateinjs/src/wrappers/oai.ts) automatically instrument OpenAIembeddings.create()calls.What is missing
No embeddings usage extractor — The existing
extract_openai_usage()function insrc/extractors.rshandles chat completion responses but is not tested or documented for embeddings responses. OpenAI embeddings responses have a different usage shape (prompt_tokens+total_tokens, nocompletion_tokens) and the extractor may produce misleading metrics (e.g.total_tokensfallback computation requires bothprompt_tokensandcompletion_tokens).No embeddings span helper — There is no helper analogous to
wrap_stream_with_span(insrc/stream.rs) for embeddings calls. The Python SDK'sEmbeddingV1Wrapperand TypeScript SDK'swrapEmbeddingsautomatically capture embedding model, input text, dimensions, and token usage in traced spans. The Rust SDK provides no equivalent.No embeddings response types — The
src/stream.rsoutput types (FinalizedStream,OutputChoice,ChatMessage) are all chat-completion-specific. There are no types for representing embeddings responses (vectors, dimensions, encoding format).Why this matters
Embeddings are a core AI execution surface. Users building RAG applications, semantic search, or similarity-based evaluation in Rust cannot get automatic instrumentation for their embedding calls through this SDK, unlike users of the Python or TypeScript SDKs.
Braintrust docs status
supported — The Braintrust proxy routes
/embeddingsrequests and supports caching them (proxy docs). The OpenAI integration docs state "All API calls are automatically logged" when using the wrapper, though embeddings are not explicitly called out. The Python and TypeScript SDKs both implement embeddings wrapping.Upstream sources
EmbeddingV1Wrapper): https://github.com/braintrustdata/braintrust-sdk/blob/main/py/src/braintrust/oai.pywrapEmbeddings): https://github.com/braintrustdata/braintrust-sdk/blob/main/js/src/wrappers/oai.tsLocal files inspected
src/extractors.rs—extract_openai_usage()andextract_anthropic_usage()handle chat completion usage; no embeddings-specific extraction or testssrc/stream.rs—BraintrustStream,FinalizedStream,OutputChoice,ChatMessageare all chat-completion-specific; no embeddings typessrc/types.rs—UsageMetricsstruct has no embeddings-specific fieldssrc/lib.rs— public API exports; no embeddings referencesCargo.toml— no embeddings-related dependenciestests/— no embeddings test scenarios