Skip to content

Google GenAI models.generateImages() (Imagen) not instrumented (wrapper and auto-instrumentation) #1673

Description

@braintrust-bot

Summary

The @google/genai SDK provides a stable models.generateImages() method for AI-powered image generation using Imagen models, but neither the wrapper (wrapGoogleGenAI) nor the auto-instrumentation plugin instruments it. Calls to this method produce no Braintrust spans. By contrast, OpenAI's images.generate() is tracked as a gap in BT-4495, and the Vercel AI SDK's generateImage() in BT-4468 — this is the Google GenAI equivalent.

What is missing

  • Wrapper (js/src/wrappers/google-genai.ts): wrapModels() only proxies generateContent and generateContentStream. generateImages 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 generateImages.
  • Channels (js/src/instrumentation/plugins/google-genai-channels.ts): No channel definition for image generation.
  • Plugin (js/src/instrumentation/plugins/google-genai-plugin.ts): No handler for image generation calls.
  • Vendor types (js/src/vendor-sdk-types/google-genai.ts): GoogleGenAIModels interface only declares generateContent and generateContentStream. No generateImages method.

Upstream reference

  • Imagen API docs: https://ai.google.dev/gemini-api/docs/imagen
  • SDK method: ai.models.generateImages({ model, prompt, config }) — returns generated image data.
  • GA models: imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, imagen-4.0-fast-generate-001.
  • Config options: numberOfImages, aspectRatio, imageSize, personGeneration.
  • This is a stable, production API — not marked experimental or preview.

Braintrust docs status

The Braintrust Gemini integration page lists generateContent and generateContentStream as supported methods. generateImages / Imagen is not mentioned (not_found).

Precedent in this repo

Image generation instrumentation gaps have been filed for other providers:

  • OpenAI images.generate(): BT-4495
  • Vercel AI SDK generateImage(): BT-4468
  • OpenAI Responses API image_generation_call output is already handled with processImagesInOutput converting base64 to Attachment objects — a similar approach could apply here.

Local files inspected

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions