Skip to content

Google GenAI: generate_images() (Imagen) not instrumented #154

@braintrust-bot

Description

@braintrust-bot

Gap

The Google GenAI image generation API (client.models.generate_images()) is not instrumented. Calling it on a client set up via setup_genai() produces no Braintrust span.

The current Google GenAI wrapper patches three methods on Models/AsyncModels: _generate_content, generate_content_stream, and embed_content. The generate_images method is not patched, so calls pass through to the original untraced implementation.

This is the Google-side equivalent of the gap tracked in #124 (OpenAI Images API).

What is missing

  • client.models.generate_images() (sync) — text-to-image generation using Imagen models. Should create a span logging the prompt, model, number of images, image size/aspect ratio, safety filter level, and response image metadata.
  • client.aio.models.generate_images() (async variant)

Token metrics do not apply to image generation, but latency, model, prompt, and request/response metadata are all valuable for observability.

Braintrust docs status

not_found — the Gemini integration page does not mention image generation or Imagen.

Upstream sources

Local files inspected

  • py/src/braintrust/wrappers/google_genai/__init__.py:
    • wrap_models() (line 60) — patches _generate_content, generate_content_stream, and embed_content only; generate_images is absent
    • wrap_async_models() — same three methods, no generate_images
    • Zero references to generate_images, imagen, or image_generation in the file
  • py/src/braintrust/wrappers/test_google_genai.py — no image generation test cases

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions