You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
types.GoogleSearch doesn't return GroundingChunk with actual text snippet #3235
The grounding chunk should be accompanied by the actual snippet/full text used during generation. Otherwise, results are not possible to validate other than by fetching the original link.
Environment details
Programming language: python
OS: macos
Language runtime version: 3.14.3
Package version: 2.33.0
Steps to reproduce
fromgoogle.genaiimporttypes, Clientclient=Client(vertexai=True, project="...", location="...", credentials="...")
response=awaitclient.aio.models.generate_content(
model="gemini-3.8-flash",
contents="why doesn't google genai with GoogleSearch grounding return GroundingChunk with text snippets?",
config=types.GenerateContentConfig(tools=[types.Tool(google_search=types.GoogleSearch())]),
)
print(response.candidates[-1].grounding_metadata.grounding_chunks[0].web)
>>>GroundingChunk(
>>>web=GroundingChunkWeb(
>>>domain='somedomain.com',
>>>title='somedomain.com',
>>>uri='https://vertexaisearch.cloud.google.com/grounding-api-redirect/...'>>> )
>>> )
The GroundingChunk.web object returned by Google Search grounding provides only uri and title by backend API design; search index text snippets are not returned in the web grounding chunk payload.
To correlate sources with the generated output without fetching the URLs, inspect candidate.grounding_metadata.grounding_supports. This structure maps segments in the generated response to the corresponding chunk indices:
If your workload strictly requires retrieved text snippets inside grounding_chunks, consider using Vertex AI Search data stores (types.VertexAISearch), which return retrieved_context chunks containing the snippet text.
Because GroundingChunk fields are defined and populated directly by the Vertex AI backend service rather than the Python SDK, adding search snippet content to types.GoogleSearch chunks would require a service-level update. You can submit a feature request directly through Google Cloud Support or the Cloud Console feedback channel..
Activity
Venkaiahbabuneelam commentedon Oct 29, 2026
Hi @guillermojp,
The
GroundingChunk.webobject returned by Google Search grounding provides onlyuriandtitleby backend API design; search index text snippets are not returned in the web grounding chunk payload.To correlate sources with the generated output without fetching the URLs, inspect
candidate.grounding_metadata.grounding_supports. This structure maps segments in the generated response to the corresponding chunk indices:If your workload strictly requires retrieved text snippets inside
grounding_chunks, consider using Vertex AI Search data stores (types.VertexAISearch), which returnretrieved_contextchunks containing the snippet text.For details on grounding structures and response fields, refer to the Vertex AI Grounding overview.
Because
GroundingChunkfields are defined and populated directly by the Vertex AI backend service rather than the Python SDK, adding search snippet content totypes.GoogleSearchchunks would require a service-level update. You can submit a feature request directly through Google Cloud Support or the Cloud Console feedback channel..Thanks
github-actions commentedon Nov 6, 2026
This issue has been marked as stale because it has been open for 7 days with no activity. It will be closed in 2 days if no further activity occurs.