-
Notifications
You must be signed in to change notification settings - Fork 3
Vercel AI SDK embed and embedMany not instrumented (wrapper and auto-instrumentation) #1625
Copy link
Copy link
Open
Feature
Copy link
Labels
bot-automationIssues generated by an agent automationIssues generated by an agent automation
Description
Summary
The Vercel AI SDK exports stable embed() and embedMany() core functions for generating vector embeddings, but neither the wrapper (wrapAISDK) nor the auto-instrumentation plugin instruments them. Calls to these functions produce no Braintrust spans. By contrast, OpenAI's embeddings.create() is fully instrumented in this repo across all three layers (wrapper, auto-instrumentation config, and plugin).
What is missing
- Wrapper (
js/src/wrappers/ai-sdk/ai-sdk.ts):wrapAISDKonly wrapsgenerateText,streamText,generateObject,streamObject, and Agent class methods. No handling ofembedorembedMany. - Auto-instrumentation config (
js/src/auto-instrumentations/configs/ai-sdk.ts): Only defines configs forgenerateText,streamText,generateObject,streamObject, and Agent variants. No config forembedorembedMany. - Channels (
js/src/instrumentation/plugins/ai-sdk-channels.ts): No channel definitions forembedorembedMany. - Plugin (
js/src/instrumentation/plugins/ai-sdk-plugin.ts): No handler for embedding calls.
Upstream reference
- AI SDK
embed()reference: https://ai-sdk.dev/docs/reference/ai-sdk-core/embed - AI SDK
embedMany()reference: https://ai-sdk.dev/docs/reference/ai-sdk-core/embed-many - Both are stable core functions (not experimental), available since AI SDK v3.0.0.
embed()returns{ embedding, value, usage, warnings, response }.embedMany()returns{ embeddings, values, usage, warnings, responses }.
Braintrust docs status
The Braintrust tracing guide lists "Vercel AI SDK" as a supported integration but does not enumerate which AI SDK functions are covered. embed/embedMany are not mentioned (not_found).
Precedent in this repo
OpenAI embeddings are instrumented in all three layers:
- Wrapper:
js/src/wrappers/oai.ts(wrapEmbeddings) - Auto-instrumentation config:
js/src/auto-instrumentations/configs/openai.ts - Plugin:
js/src/instrumentation/plugins/openai-plugin.ts
Google GenAI embeddings are tracked as a separate gap in #1620.
Local files inspected
js/src/wrappers/ai-sdk/ai-sdk.tsjs/src/auto-instrumentations/configs/ai-sdk.tsjs/src/instrumentation/plugins/ai-sdk-channels.tsjs/src/instrumentation/plugins/ai-sdk-plugin.tsjs/src/vendor-sdk-types/ai-sdk-common.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bot-automationIssues generated by an agent automationIssues generated by an agent automation