Hello,
I am using Grounding with Web Search via API , model = gemini-2.0-flash, and have the suspicion that most times Gemini does not perform a web search, but rather pretends to do so.
While inspecting the response, I see these 3 parts:
web_search_queries: this should show the queries used, but most of the time is empty, but the response text says “I went to this website bla bla and found this”.
grounding_metadata: I think if this is not none, then some kind of grounding happened, but not necessarily with a web search.
grounding_chunks: I believe this is the external information retrieved and it is populated.
If the model is not performing a real-time web search to find the external info, where is this grounding metadata and chunks coming from? Am I interpreting these attributes wrong?
From the models 2.0 and beyond, Gemini will automatically decide whether to go for web search or not based on the query. We just need to configure search tool and need not to configure dynamic retrieval.
Once it goes for web search, in the metadata we get the links. I tried with few prompts its working fine. Can you share your prompt which require web search if possible so i can repro the issue.
If it does an actual Google search, you will see the search terms it used inserted at the end of its comment. Sometimes it will lie and say that it did a search when it didn’t. Sometimes, it seems to genuinely believe it did the search, but it didn’t.
Sorry, I don’t know from memory which of the countless prompts I’ve given it didn’t lead to Google searches… And I don’t think there’s anything about the wording of the prompt that causes it to claim that it did a Google search when it didn’t. There’s no reason whatsoever to think that you could get the same result as I did with the same prompt even if I had one; it’s a rare random result.