Summary
The Google GenAI image editing API (Models.edit_image() / AsyncModels.edit_image()) is not instrumented. Calls to edit images using Imagen models produce zero Braintrust tracing. This is the image-editing counterpart to Models.generate_images(), which IS instrumented in this repo.
What is missing
| Google GenAI Method |
Instrumented? |
models.generate_content() |
Yes |
models.generate_content_stream() |
Yes |
models.embed_content() |
Yes |
models.generate_images() |
Yes |
models.edit_image() |
No |
async_models.edit_image() |
No |
models.generate_videos() |
No (tracked in #236) |
The edit_image() method is the SDK entry point for AI-powered image editing operations including inpainting, outpainting, style transfer, and subject-based editing using Imagen models. It accepts a prompt, a reference image, and editing config, and returns an edited image result.
Minimum instrumentation
At minimum, both sync and async edit_image() should create spans capturing:
- Input: prompt text, reference image metadata, model name, editing config
- Output: edited image metadata (format, dimensions)
- Metrics: latency
- Metadata: model, editing parameters
The pattern should mirror the existing ModelsGenerateImagesPatcher / AsyncModelsGenerateImagesPatcher and reuse the _generate_images_wrapper / _async_generate_images_wrapper infrastructure if the response format is compatible, or define new _edit_image_wrapper / _async_edit_image_wrapper functions if not.
Braintrust docs status
not_found — The Gemini integration page documents generate_content, streaming, function calling, structured outputs, thinking tokens, and context caching. Image generation (generate_images) is supported. Image editing (edit_image) is not mentioned.
Upstream sources
Local files inspected
py/src/braintrust/integrations/google_genai/patchers.py — defines ModelsGenerateImagesPatcher and AsyncModelsGenerateImagesPatcher but no edit_image patchers; zero references to edit_image
py/src/braintrust/integrations/google_genai/tracing.py — contains _generate_images_wrapper and _async_generate_images_wrapper but no edit_image wrappers
py/src/braintrust/integrations/google_genai/integration.py — integration class registers image generation patchers but no image editing patchers
py/src/braintrust/integrations/google_genai/test_google_genai.py — no edit_image test cases
py/pyproject.toml — Google GenAI matrix: latest pinned to google-genai==1.74.0
Relationship to existing issues
Summary
The Google GenAI image editing API (
Models.edit_image()/AsyncModels.edit_image()) is not instrumented. Calls to edit images using Imagen models produce zero Braintrust tracing. This is the image-editing counterpart toModels.generate_images(), which IS instrumented in this repo.What is missing
models.generate_content()models.generate_content_stream()models.embed_content()models.generate_images()models.edit_image()async_models.edit_image()models.generate_videos()The
edit_image()method is the SDK entry point for AI-powered image editing operations including inpainting, outpainting, style transfer, and subject-based editing using Imagen models. It accepts a prompt, a reference image, and editing config, and returns an edited image result.Minimum instrumentation
At minimum, both sync and async
edit_image()should create spans capturing:The pattern should mirror the existing
ModelsGenerateImagesPatcher/AsyncModelsGenerateImagesPatcherand reuse the_generate_images_wrapper/_async_generate_images_wrapperinfrastructure if the response format is compatible, or define new_edit_image_wrapper/_async_edit_image_wrapperfunctions if not.Braintrust docs status
not_found — The Gemini integration page documents
generate_content, streaming, function calling, structured outputs, thinking tokens, and context caching. Image generation (generate_images) is supported. Image editing (edit_image) is not mentioned.Upstream sources
Models.edit_image()andAsyncModels.edit_image()are public methodsedit_imageat line 6627 (sync), line 8687 (async), with internal_edit_imageimplementationsLocal files inspected
py/src/braintrust/integrations/google_genai/patchers.py— definesModelsGenerateImagesPatcherandAsyncModelsGenerateImagesPatcherbut noedit_imagepatchers; zero references toedit_imagepy/src/braintrust/integrations/google_genai/tracing.py— contains_generate_images_wrapperand_async_generate_images_wrapperbut noedit_imagewrapperspy/src/braintrust/integrations/google_genai/integration.py— integration class registers image generation patchers but no image editing patcherspy/src/braintrust/integrations/google_genai/test_google_genai.py— noedit_imagetest casespy/pyproject.toml— Google GenAI matrix: latest pinned togoogle-genai==1.74.0Relationship to existing issues
generate_images()(Imagen) not instrumented #154 (closed) addedgenerate_imagesinstrumentation —edit_imageis the adjacent gap on the sameModelsclassmodels.generate_videos()) not instrumented #236 tracksgenerate_videos(another missing generative method onModels)