Add Gemini 3.6 and 3.7 structured VLM output support - #2504
Open
Xayar145 wants to merge 1 commit into
Open
Conversation
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.
Before submitting
Description
Adds Google Gemini 3.6 and 3.7 adapters to Detections.from_vlm for the current structured object-detection and segmentation response format.
Type of Change
Motivation and Context
The existing Gemini adapters stop at 3.5 and expect the legacy top-level array and encoded-mask format. Gemini 3.6 and 3.7 structured responses wrap items in a top-level boxes object and represent segmentation masks as normalized polygons. Without dedicated VLM members and parsing, Detections.from_vlm rejects these model variants.
Format reference: https://ai.google.dev/gemini-api/docs/image-understanding#object-detection
Changes Made
Testing
I have tested this code locally
I have added unit tests that prove the feature works
All new and existing tests pass
Focused VLM suite: 114 passed
Full suite: 3617 passed, 20 skipped
Pre-commit: all hooks passed, including Ruff, mypy, codespell, and Markdown formatting
Additional Notes
The 3.7 adapter reuses the 3.6 structured parser because both versions expose the same box and polygon schema.