googleSearchRetrieval on gemini 2 flash

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