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
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 byjs/src/instrumentation/plugins/google-genai-plugin.ts), but not the older@google/generative-aipackage. Users who have not yet migrated to@google/genaiget no Braintrust spans.What instrumentation is missing
The
@google/generative-aipackage exposes these execution surfaces, none of which are instrumented:model.generateContent(request)model.generateContentStream(request)model.embedContent(request)model.batchEmbedContents(request)chat.sendMessage(request)/chat.sendMessageStream(request)These methods are accessible via
const model = genAI.getGenerativeModel({ model: "gemini-..." })andconst chat = model.startChat(...).No coverage in any instrumentation layer:
js/src/auto-instrumentations/configs/targeting@google/generative-aijs/src/instrumentation/plugins/for@google/generative-ai@google/generative-aiA search for
@google/generative-aiacrossjs/src/returns zero matches.Context
Google deprecated
@google/generative-aiin favor of@google/genai, but the legacy package remains at v0.24.1 with approximately 3 million weekly npm downloads — far exceeding the@google/genaiadoption rate. This means the majority of JavaScript Gemini SDK users currently receive no Braintrust instrumentation coverage, even though Braintrust fully supports the equivalent@google/genaiAPI surface viawrapGoogleGenAI.The existing
google-genaiplugin in this repo (js/src/auto-instrumentations/configs/google-genai.ts) exclusively targets@google/genaiversions>=1.0.0and does not patch any path from@google/generative-ai.Braintrust docs status
supportedfor Google Gemini via@google/genaionly. The Braintrust docs page at https://www.braintrust.dev/docs/integrations/ai-providers/gemini references@google/genaiexclusively and does not mention@google/generative-ai.Upstream references
@google/generative-ainpm package: https://www.npmjs.com/package/@google/generative-ai@google/genai: https://ai.google.dev/gemini-api/docs/migrateLocal files inspected
js/src/auto-instrumentations/configs/google-genai.ts— instruments@google/genaiversions>=1.0.0only; no entry for@google/generative-aijs/src/instrumentation/plugins/google-genai-plugin.ts— handles@google/genaionlyjs/src/instrumentation/plugins/google-genai-channels.ts— channels defined for@google/genaionlye2e/scenarios/google-genai-instrumentation/— test scenario targets@google/genaionly@google/generative-aiinjs/src/— zero matches