Method: projects.locations.ragCorpora.ragFiles.list

Lists RagFiles in a RagCorpus.

Endpoint

get https://aiplatform.googleapis.com/v1beta1/{parent}/ragFiles

Path parameters

parent string

Required. The resource name of the RagCorpus from which to list the RagFiles. Format: projects/{project}/locations/{location}/ragCorpora/{ragCorpus}

Query parameters

pageSize integer

Optional. The standard list page size.

pageToken string

Optional. The standard list page token. Typically obtained via ListRagFilesResponse.next_page_token of the previous VertexRagDataService.ListRagFiles call.

Request body

The request body must be empty.

Example request

Python


from vertexai.preview import rag
import vertexai

# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"

# Initialize Vertex AI API once per session
vertexai.init(project=PROJECT_ID, location="us-central1")

files = rag.list_files(corpus_name=corpus_name)
for file in files:
    print(file.display_name)
    print(file.name)
# Example response:
# g-drive_file.txt
# projects/1234567890/locations/us-central1/ragCorpora/111111111111/ragFiles/222222222222
# g_cloud_file.txt
# projects/1234567890/locations/us-central1/ragCorpora/111111111111/ragFiles/333333333333

Response body

Response message for VertexRagDataService.ListRagFiles.

If successful, the response body contains data with the following structure:

Fields
ragFiles[] object (RagFile)

List of RagFiles in the requested page.

nextPageToken string

A token to retrieve the next page of results. Pass to ListRagFilesRequest.page_token to obtain that page.

JSON representation
{
  "ragFiles": [
    {
      object (RagFile)
    }
  ],
  "nextPageToken": string
}