Skip to content

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

@braintrust-bot

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 #1628, and the Vercel AI SDK's generateImage() in #1626 — 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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot-automationIssues generated by an agent automation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions