From what I can see you can use the google_search tool with 2 flash but but you cant set a dynamicThreshold of 0 to always force it into searching. Is there a way to do this so that the model is always grounded? I couldnt find anything in the docs on this.
Hi
Welcome to the forum.
Based on your writing, I wonder whether you are mixing the two available tools.
- Google Search
- Google Search Retrieval
See here: Grounding with Google Search | Gemini API | Google AI for Developers
Ahhh, I see…
Note: Dynamic retrieval is only compatible with Gemini 1.5 Flash. For Gemini 2.0, you should use Search as a tool, as shown above.
I’d assume it’s a cost efficiency decision by the Gemini API to dynamically decided whether Search shall be consulted or not. Maybe someone from the team could comment on that?
Getting an HTTP 400 on the Gemini 2.0 models.
Unable to submit request because Please use google_search field instead of google_search_retrieval field.. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
Cheers
Hey! Thanks for the response, you are correct they are different, however for my use case for this specific part of my app I need it to always use grounded search not have the model decide when to use it as I need the sources to display to the user etc. it would be nice if the there was a way to do that with the Google_search tool
Can a Gemini team member provide some insight here?
Hey @cor , I don’t think we can force the model to give grounded responses with gemini-2.0 model, as the google_search
tool is implemented internally, giving the model the autonomy to decide when to use google search to ground its responses. It is kind of an agentic nature, I would say.
That is very unfortunate as we have a use case where we always want grounded results with sources for a part of our app and Google has just deprecated gemini 1.5. So there is no work around for this at all?
There must be a way though because the ai studio has the ability to always run grounded search with flash 2 if you toggle it on