How to use Gemini Search Grounding with Structured Output? #550
Unanswered
swistaczek
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use Gemini's built-in Google Search grounding feature with ruby_llm. I found that passing
tools: [{ google_search: {} }]viawith_paramsworks:This works great for free-form responses. However, when I try to combine it with
with_schemafor structured output, the search grounding doesn't trigger:Questions:
Is this a known limitation of Gemini's API (google_search incompatible with
responseMimeType: 'application/json')?Is there a recommended pattern in ruby_llm for combining search grounding with structured responses? For example, should I parse JSON from the text response manually?
Would it make sense to have a built-in
with_search_groundinghelper that handles this case?Current workaround: Use search grounding without schema and parse JSON from text response:
Thanks for this great gem!
Beta Was this translation helpful? Give feedback.
All reactions