This document describes how to manage your RAG knowledge base (corpus). This document covers the following topics: A corpus is a collection of documents that you can query to retrieve relevant contexts for response generation. When you create a corpus for the first time, the process might take an additional minute. You can perform the following operations on a corpus: If you're using VPC-SC and it's the first time that you've called `createRagCorpus` and the call returns an error, then just wait a few minutes and retry. Concurrent operations on corpora aren't supported. For more information, see the
RAG API reference for v1beta1 or RAG API reference for v1. You can add files to your corpus by either uploading them directly or importing them from another storage location. The following table compares these two methods. You can perform the following operations on files in a corpus:
Corpus management
Operation
Description
Parameters
Examples
Create a RAG corpus
Create a RAG corpus to import or upload documents.
Create parameters v1beta1
Create parameters v1Create example v1beta1
Create example v1
Update a RAG corpus
Update a previously-created RAG corpus to import or upload documents.
Update parameters v1beta1
Update parameters v1Update example v1beta1
Update example v1
List RAG corpora
List all of the RAG corpora.
List parameters v1beta1
List parameters v1List example v1beta1
List example v1
Get a RAG corpus
Get the metadata describing the RAG corpus.
Get parameters v1beta1
Get parameters v1Get example v1beta1
Get example v1
Delete a RAG corpus
Delete the RAG corpus.
Delete parameters v1beta1
Delete parameters v1Delete example v1beta1
Delete example v1File management
Method
Description
Use Case
Upload a RAG file
Uploads a single file from your local machine to the RAG corpus.
Best for adding individual files or a small number of files quickly.
Import RAG files
Imports a batch of files from a storage location like Google Cloud Storage.
Ideal for adding a large number of files at once or for automated workflows where files are already in cloud storage.
Operation
Description
Parameters
Examples
Upload a RAG file
Upload a file from local storage with additional information that provides context to the LLM to generate more accurate responses.
Upload parameters v1beta1
Upload parameters v1Upload example v1beta1
Upload example v1
Import RAG files
Import a set of files from some other storage into a storage location.
Import parameters v1beta1
Import parameters v1Import example v1beta1
Import example v1
List RAG files
List all of the files in the RAG corpus.
List parameters v1beta1
List parameters v1List example v1beta1
List example v1
Get a RAG file
Get details about a RAG file for use by the LLM.
Get parameters v1beta1
Get parameters v1Get example v1beta1
Get example v1
Delete a RAG file
Delete a file from the RAG corpus.
Delete parameters v1beta1
Delete parameters v1Delete example v1beta1
Delete example v1What's next
Manage your RAG knowledge base (corpus)
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-27 UTC.