Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Request for new functionality
View staffing
Description
Problem you have encountered:
When requesting grounding, I am unable to also specify structured output of JSON format. My present workaround is to make two calls to Gemini: the first to retrieve grounded information, the second to take that grounded information and massage it into an expected JSON schema. Furthermore, if the system prompt contains anything that looks like JSON, such as {}, the request will no longer be grounded.
What you expected to happen:
Being able to request grounding and structured output in the same call. Furthermore, being able to control grounding to always happen, such as setting a dynamicThreshold to 0 (which is supported in Gemini 1.5), would be fantastic. See Example curl below of an ideal API call:
Steps to reproduce:
Other information (workarounds you have tried, documentation consulted, etc):
This can be mitigated by making two calls to Gemini: the first for grounding and then the second for structured output based on the response from the first call. This is less than ideal, considering that LLM calls are not the fastest and this could be handled with one request.