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: For more information about grounding, see Grounding overview. See examples for implementation details. Ground the response with public data. Required: Ground with publicly available web data. 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. Required: Ground with Vertex AI Search data sources. Required: Fully-qualified data store resource ID from Vertex AI Search, in the
following format: Ground the response with Google Search public data. Include the
To learn more, see the
SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
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:
Supported models
Parameter list
GoogleSearchRetrieval
Parameters
google_search_retrieval
Object
Retrieval
Parameters
source
VertexAISearch
VertexAISearch
Parameters
datastore
string
projects/{project}/locations/{location}/collections/default_collection/dataStores/{datastore}
Examples
Ground response on public web data using Google Search
google_search_retrieval
tool in the request. No additional parameters are required.Python
Install
pip install --upgrade google-genai
# 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
# 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 AI Applications.
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: