Skip to content

rag.get_corpus() does not return corpus state or creation/update timestamps in RAG Engine #6168

@Nithya-Vasudevan-vn10876

Description

Description:

The rag.get_corpus() method works at runtime, but it does not return fields such as corpus_status.state, create_time, and update_time. These fields are present when using rag.list_corpora() for the same corpus.

As a result, fetching a single corpus requires listing all corpora and filtering manually, which is inefficient and inconsistent.

If you are still having issues, please be sure to include as much information as possible:

Environment details

google-cloud-aiplatform version: 1.121.0
Vertex AI RAG Engine (GA)
Python version: 3.13

Steps to reproduce

from vertexai import rag

corpus_id = "my-corpus-id"
corpus_name = f"projects/{PROJECT_ID}/locations/{LOCATION}/ragCorpora/{corpus_id}"

corpus = rag.get_corpus(name=corpus_name)

Raises Attribute error

print(corpus.corpus_status)
print(corpus.create_time)
print(corpus.update_time)

Code example (Workaround)

all_corpora = rag.list_corpora()
target_corpus = next(c for c in all_corpora if c.name.endswith(corpus_id))

print(target_corpus.corpus_status.state)
print(target_corpus.create_time)
print(target_corpus.update_time)

Stack trace

Traceback (most recent call last):
File "xx/xx/rag_tools.py", line 628, in
print(corpus.corpus_status)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'RagCorpus' object has no attribute 'corpus_status'

print(corpus.create_time)
      ^^^^^^^^^^^^^^^^^^

AttributeError: 'RagCorpus' object has no attribute 'create_time'

print(corpus.update_time)
      ^^^^^^^^^^^^^^^^^^

AttributeError: 'RagCorpus' object has no attribute 'update_time'

Expected Behavior

get_corpus() should return the following fields for a single corpus:

corpus_status.state
create_time
update_time

This would make get_corpus() consistent with list_corpora() and eliminate the need to list all corpora just to fetch one.

Actual Behavior

get_corpus() returns a corpus object, but the above fields are missing.
Only workaround: list all corpora and filter, which is inefficient if there are many corpora.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: vertex-aiIssues related to the googleapis/python-aiplatform API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions