Skip to content

[bot] Legacy Google Generative AI SDK (@google/generative-ai) not instrumented — 3M weekly downloads with no tracing coverage #2006

@braintrust-bot

Description

@braintrust-bot

Summary

The legacy Google Generative AI JavaScript SDK (@google/generative-ai, v0.24.1, ~3 million weekly npm downloads) provides execution APIs for Gemini model generation and embeddings. This repository instruments only the newer unified SDK (@google/genai, covered by js/src/instrumentation/plugins/google-genai-plugin.ts), but not the older @google/generative-ai package. Users who have not yet migrated to @google/genai get no Braintrust spans.

What instrumentation is missing

The @google/generative-ai package exposes these execution surfaces, none of which are instrumented:

SDK Method Description
model.generateContent(request) Unary text and multimodal generation
model.generateContentStream(request) Streaming generation
model.embedContent(request) Single text embedding
model.batchEmbedContents(request) Batch text embeddings
chat.sendMessage(request) / chat.sendMessageStream(request) Multi-turn chat completions

These methods are accessible via const model = genAI.getGenerativeModel({ model: "gemini-..." }) and const chat = model.startChat(...).

No coverage in any instrumentation layer:

  • No auto-instrumentation config in js/src/auto-instrumentations/configs/ targeting @google/generative-ai
  • No plugin handler in js/src/instrumentation/plugins/ for @google/generative-ai
  • No diagnostics channels for @google/generative-ai
  • No e2e test scenarios

A search for @google/generative-ai across js/src/ returns zero matches.

Context

Google deprecated @google/generative-ai in favor of @google/genai, but the legacy package remains at v0.24.1 with approximately 3 million weekly npm downloads — far exceeding the @google/genai adoption rate. This means the majority of JavaScript Gemini SDK users currently receive no Braintrust instrumentation coverage, even though Braintrust fully supports the equivalent @google/genai API surface via wrapGoogleGenAI.

The existing google-genai plugin in this repo (js/src/auto-instrumentations/configs/google-genai.ts) exclusively targets @google/genai versions >=1.0.0 and does not patch any path from @google/generative-ai.

Braintrust docs status

supported for Google Gemini via @google/genai only. The Braintrust docs page at https://www.braintrust.dev/docs/integrations/ai-providers/gemini references @google/genai exclusively and does not mention @google/generative-ai.

Upstream references

Local files inspected

  • js/src/auto-instrumentations/configs/google-genai.ts — instruments @google/genai versions >=1.0.0 only; no entry for @google/generative-ai
  • js/src/instrumentation/plugins/google-genai-plugin.ts — handles @google/genai only
  • js/src/instrumentation/plugins/google-genai-channels.ts — channels defined for @google/genai only
  • e2e/scenarios/google-genai-instrumentation/ — test scenario targets @google/genai only
  • Full repo grep for @google/generative-ai in js/src/ — zero matches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions