Grounding connects model responses to verifiable sources of information to make them more trustworthy, helpful, and factual. A common method to implement grounding is retrieval-augmented generation (RAG). RAG uses a search engine to retrieve relevant information from an indexed data source based on the semantic meaning of the source text. This document shows you how to ground model responses using RAG in Vertex AI and covers the following topics: You can implement a RAG solution by using a combination of the following services and APIs: To ground responses using Vertex AI RAG Engine, follow these steps to create a prompt: In the Google Cloud console, go to the Create prompt page in Vertex AI Studio. Select Grounding: Your data. Select RAG Engine as the grounding source. From the Corpus list, select your corpus name. In the Top-K Similarity field, select 20, which is the default. Click Save.
Components for building a RAG solution
Service / API
Description
Use Case
Grounding generation API
Connects your generative model to a data source to enable grounding for the entire RAG lifecycle.
When you need to connect your generative model to a data source for fact-based responses.
Document layout parser
Combines features from Document AI and Gemini for advanced document understanding. For more information, see Use the layout parser.
For processing complex documents with varied layouts, such as PDFs with tables and images, for retrieval.
Vertex AI Vector Search
A search service that uses a vector database to find information based on semantic meaning.
For building the retrieval part of a RAG system that needs to find relevant information based on meaning.
Check grounding API
Compares the model's generated response with the retrieved source data to verify that the response is factually grounded.
As a final step in your RAG pipeline to help ensure the generated response is factually consistent with the source data.
Ground responses using Vertex AI RAG Engine
What's next
Ground responses using RAG
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-26 UTC.