feat(google_genai): add generate_images tracing support#161
Open
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Open
feat(google_genai): add generate_images tracing support#161Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Conversation
Add tracing for the Google GenAI generate_images API (both sync and
async). Generated image bytes are wrapped in Attachment objects so the
SDK uploads them to object storage and the Braintrust UI can render
them, following the same pattern used for input-side inline_data in
both the google_genai and adk integrations.
Key changes:
- ModelsGenerateImagesPatcher and AsyncModelsGenerateImagesPatcher
- _generate_images_wrapper / _async_generate_images_wrapper
- Output includes image metadata (size, mime type, safety attrs) plus
an Attachment per generated image in {"image_url": {"url": attachment}}
- VCR before_record_response sanitizes image bytes in cassettes
- Sync and async test cases validate span structure, metrics, and
Attachment objects
f60a543 to
d1d1108
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #154
Add tracing for the Google GenAI generate_images API (both sync and async). This includes patchers, input/output serialization, metric extraction, and VCR-based tests with image payload sanitization to keep cassettes small.
Key changes: