Skip to content

Vercel AI SDK embed and embedMany not instrumented (wrapper and auto-instrumentation) #1625

@braintrust-bot

Description

@braintrust-bot

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): wrapAISDK only wraps generateText, streamText, generateObject, streamObject, and Agent class methods. No handling of embed or embedMany.
  • Auto-instrumentation config (js/src/auto-instrumentations/configs/ai-sdk.ts): Only defines configs for generateText, streamText, generateObject, streamObject, and Agent variants. No config for embed or embedMany.
  • Channels (js/src/instrumentation/plugins/ai-sdk-channels.ts): No channel definitions for embed or embedMany.
  • Plugin (js/src/instrumentation/plugins/ai-sdk-plugin.ts): No handler for embedding calls.

Upstream reference

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.ts
  • js/src/auto-instrumentations/configs/ai-sdk.ts
  • js/src/instrumentation/plugins/ai-sdk-channels.ts
  • js/src/instrumentation/plugins/ai-sdk-plugin.ts
  • js/src/vendor-sdk-types/ai-sdk-common.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions