In generative AI, grounding is the ability to connect model output to verifiable sources of information. If you provide models with access to specific data sources, then grounding tethers their output to these data and reduces the chances of inventing content.
With Vertex AI, you can ground model outputs in the following ways:
- Ground with Google Search - ground a model with publicly-available web data.
- Ground with Google Maps - ground a model with geospatial data from Google Maps.
- Ground to your data - ground a model with your data from Vertex AI Search as a data store.
For more information about grounding, see Grounding overview.
Supported models
- Gemini 2.5 Flash (Preview)
- Gemini 2.5 Flash-Lite (Preview)
- Gemini 2.5 Flash-Lite
- Gemini 2.5 Flash with Live API native audio (Preview)
- Gemini 2.0 Flash with Live API (Preview)
- Gemini 2.5 Pro
- Gemini 2.5 Flash
- Gemini 2.0 Flash
Parameter list
See examples for implementation details.
googleSearch
Ground the response with publicly-available web data from Google Search.
googleMaps
Ground the response with publicly-available geospatial data from Google Maps.
The API input includes the following parameter:
Input parameter | |
---|---|
| Required:
Flag that can be set to |
The API response structure includes the following parameter:
Response parameter | ||
---|---|---|
|
Required: The primary field that contains grounding information. |
|
Attributes
A place or user review source has the following attributes:
Attributes | |
---|---|
|
Required: The title of the source. |
|
Required: A URI linking to the source. |
|
Required: A unique identifier for the place. |
|
Required: A unique identifier for review. |
retrieval
Ground the response with private data from Vertex AI Search as a data store. Defines a retrieval tool that the model can call to access external knowledge.
Parameters | |
---|---|
|
Required: Ground with Vertex AI Search data sources. |
VertexAISearch
Parameters | |
---|---|
|
Required: Fully-qualified data store resource ID from Vertex AI Search, in the
following format: |
Examples
This section provides examples for grounding a response on public web data using Google Search and grounding a response on private data using Vertex AI Search.
Ground response on public web data using Google Search
Ground the response with Google Search public data. Include the google_search_retrieval
tool in the request. No additional parameters are required.
Python
Install
pip install --upgrade google-genai
To learn more, see the SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values # with appropriate values for your project. export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT export GOOGLE_CLOUD_LOCATION=global export GOOGLE_GENAI_USE_VERTEXAI=True
Go
Learn how to install or update the Go.
To learn more, see the SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values # with appropriate values for your project. export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT export GOOGLE_CLOUD_LOCATION=global export GOOGLE_GENAI_USE_VERTEXAI=True
Java
Learn how to install or update the Java.
To learn more, see the SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values # with appropriate values for your project. export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT export GOOGLE_CLOUD_LOCATION=global export GOOGLE_GENAI_USE_VERTEXAI=True
Ground response on private data using Vertex AI Search
Ground the response with data from a Vertex AI Search data store. For more information, see Vertex AI Search.
Before you ground a response with private data, create a data store and a search app.
WARNING: For the time being, this "grounding" interface does not support Vertex AI Search "chunk mode".
Gen AI SDK for Python
What's next
For detailed documentation, see the following: