How to tell if a web search actually happened when using Grounding with Web Search

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?
1 Like

Hi @porBulerias, Welcome to the forum!!

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.

Thanks

1 Like

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.

1 Like

Hey @L-S, Can you share your prompt so that i can repro this from my end.

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.

It’s a valid point @L-S. Thanks again for flagging. Do you mind sharing the screenshot if in case you encounter such case again in future so i can raise with our engineering team with that.

Thanks

Do you want a screen cap… of the prompt? Or of the end of the response, to show that there’s no Google searches listed? Or both? In the meantime, the control to change the screen color is broken; the only current choices are black text on a black background, and black text on too dark of a gray to really read comfortably. The white background is gone. Also, when you hover over the model name and the little screen explaining it pops up, instead of having a white background, that screen has a transparent background, so the words from the pop-up overlap the words in the chat, and are nearly impossible to read. It would be great for those things to be fixed!

Yeah, Please share both. Also, regarding background issue, Are you not able to change theme (Dark theme to light theme and vice versa)? If so, can you please also attach the screen capture for that as weel.