-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Gap
When Gemini models use Google Search grounding (via the google_search tool), the response includes a grounding_metadata field containing search results, citations, search queries, and search entry points. This metadata is silently dropped from the span output — only the model's text response is captured.
Google Search grounding is one of Gemini's key differentiating features, allowing models to ground their responses in real-time web data. Without capturing the grounding metadata, users cannot verify which search results the model used, audit citation accuracy, or debug grounding quality.
What is missing
The grounding_metadata field on GenerateContentResponse.candidates[].grounding_metadata should be extracted and logged in the span output. This includes:
grounding_chunks— the actual search result snippets used by the modelgrounding_supports— which parts of the response are supported by which chunkssearch_entry_point— the rendered search widget URLweb_search_queries— the queries the model issued to Google Search
The tool declarations (google_search) pass through _serialize_tools() in the input, but the grounding results on the response side are not extracted.
Braintrust docs status
not_found — the Gemini integration page documents generate_content, streaming, function calling, structured outputs, thinking tokens, and context caching, but does not mention grounding or Google Search integration.
Upstream sources
- Google GenAI grounding guide: https://ai.google.dev/gemini-api/docs/grounding
google.genai.types.GroundingMetadata— containsgrounding_chunks,grounding_supports,search_entry_point,web_search_queries- Grounding is GA for Gemini 1.5 and 2.0 models
Local files inspected
py/src/braintrust/wrappers/google_genai/__init__.py:_gc_process_result()— processes non-streaming results; extractstext,usage_metadata, andcontent.partsbut notgrounding_metadata_serialize_tools()— serializes tool declarations (includinggoogle_search) for span input- Zero references to
grounding_metadata,grounding_chunks,grounding_supports,search_entry_point, orweb_search_queries
py/src/braintrust/wrappers/test_google_genai.py— no grounding-related test casespy/src/braintrust/integrations/adk/tracing.py— the ADK integration also does not extract grounding metadata