Uh oh!
There was an error while loading. Please reload this page.
fix(gemini): support structured output with tools on Gemini 3 models - #4184
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds Reviewed by Cursor Bugbot for commit 8e93c05. Configure here. |
Greptile SummaryThis PR fixes structured output being silently skipped when using Gemini 3 models with tools by branching on Confidence Score: 5/5Safe to merge — targeted bug fix with correct branching logic and no regressions to Gemini 2 behavior. All findings are P2 or lower. The implementation correctly uses No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Request: responseFormat + tools?] --> B{tools present?}
B -- No --> C[responseSchema via cleanSchemaForGemini\nresponseMimeType = application/json]
B -- Yes --> D{isGemini3Model?}
D -- Yes --> E[responseJsonSchema = raw schema\nresponseMimeType = application/json\ntools kept in config]
D -- No --> F[Warn: structured output deferred\ntools kept in config]
E --> G[Tool execution loop]
F --> G
G --> H{More tool calls?}
H -- Yes --> G
H -- No --> I{isGemini3Model?}
I -- Yes --> J[Strip tools\nresponseJsonSchema inherited from baseConfig]
I -- No --> K[Strip tools\nApply responseSchema + responseMimeType]
J --> L[Final structured response]
K --> L
Reviews (2): Last reviewed commit: "refactor(gemini): use prefix-based Gemin..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 15, 2026
waleedlatif1
commented
Apr 15, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8e93c05. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
…mat, logs performance improvements fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179) fix(landing): return 404 for invalid dynamic route slugs (#4182) improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170) fix(gemini): support structured output with tools on Gemini 3 models (#4184) feat(brightdata): add Bright Data integration with 8 tools (#4183) fix(mothership): fix superagent credentials (#4185) fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
Summary
responseJsonSchemaalongside tools/function declarations in the same request — Gemini 2 does notisGemini3Model()helper and branching logic to useresponseJsonSchema(notresponseSchema) for Gemini 3 + tools, preserving existing Gemini 2 behaviorType of Change
Testing
Tested manually against the live Gemini API with comprehensive matrix covering all model/tools/schema combinations.
Checklist