Hello.
I’m using Gemini Live API for my Autonomous Robot Assistant project. I have implemented couple of tools like turning on lights, navigate request for specific locations and emotion of the response of the model. I have implemented Google search too and everything since here was working fine. But I wanted to add google search result URLs to my robots User Interface, at this moment(tried to implement with grounding_metadata) it doesn’t worked. When I say the model “What is the current price of the Nvidia stocks?” model retrieves and gives the proper information but the grounding metadata becomes None at this turn. Sometimes it shows the links belong to source sometimes it doesn’t. Is there a specific reason that model doesn’t show the retrieval results? How can I implement it to my own code? Here is my code snippet of `grounding_metadata` implementation:
if chunk.server_content:
metadata = getattr(
chunk.server_content, "grounding_metadata", None
)
if metadata:
chunks_to_check = getattr(metadata, "grounding_chunks", [])
if chunks_to_check:
for g in chunks_to_check:
if hasattr(g, "web") and getattr(
g.web, "uri", None
):
url = g.web.uri
if (
url not in self._seen_urls
and url not in sent_urls_this_turn
):
self._seen_urls.add(url)
sent_urls_this_turn.add(url)
title = getattr(g.web, "title", None)
if not title:
title = (
metadata.web_search_queries[0]
if getattr(
metadata,
"web_search_queries",
None,
)
else "Kaynak"
)
print(
f"--- 🔗 GroundingChunk'tan Link: {title} ({url}) ---"
)
self.link_received.emit(url, title)
self.response_received.emit(
f"🔗 Kaynak bulundu: {title}"