Skip to content

Google GenAI embedContent not instrumented (wrapper and auto-instrumentation) #1620

@braintrust-bot

Description

@braintrust-bot

Summary

The @google/genai SDK provides a stable models.embedContent() method for generating vector embeddings, but neither the wrapper (wrapGoogleGenAI) nor the auto-instrumentation plugin instruments it. By contrast, OpenAI's embeddings.create() is fully instrumented in both paths.

What is missing

  • Wrapper (js/src/wrappers/google-genai.ts): wrapModels() only proxies generateContent and generateContentStream (lines 88–101). embedContent calls pass through untraced.
  • Auto-instrumentation config (js/src/auto-instrumentations/configs/google-genai.ts): Only defines configs for generateContentInternal and generateContentStreamInternal. No config for embedContent.
  • Plugin (js/src/instrumentation/plugins/google-genai-plugin.ts): No channel or handler for embeddings.

Upstream reference

Braintrust docs status

The Braintrust Google GenAI integration page documents generateContent only. Embeddings are not mentioned (not_found).

Precedent in this repo

OpenAI embeddings are instrumented in all three layers:

  • Wrapper: js/src/wrappers/oai.ts (lines 101–104, wrapEmbeddings)
  • Auto-instrumentation config: js/src/auto-instrumentations/configs/openai.ts (lines 59–72)
  • Plugin: js/src/instrumentation/plugins/openai-plugin.ts (lines 70–96)

Local files inspected

  • js/src/wrappers/google-genai.ts
  • js/src/auto-instrumentations/configs/google-genai.ts
  • js/src/instrumentation/plugins/google-genai-plugin.ts
  • js/src/instrumentation/plugins/google-genai-channels.ts
  • js/src/vendor-sdk-types/google-genai.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions