Method: projects.locations.ragCorpora.create

Creates a RagCorpus.

Endpoint

post https://{endpoint}/v1beta1/{parent}/ragCorpora

Where {service-endpoint} is one of the supported service endpoints.

Path parameters

parent string

Required. The resource name of the Location to create the RagCorpus in. Format: projects/{project}/locations/{location}

Request body

The request body contains an instance of RagCorpus.

Example request

Python


from vertexai.preview import rag
import vertexai

# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# display_name = "test_corpus"
# description = "Corpus Description"

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

# Configure embedding model
embedding_model_config = rag.EmbeddingModelConfig(
    publisher_model="publishers/google/models/text-embedding-004"
)

corpus = rag.create_corpus(
    display_name=display_name,
    description=description,
    embedding_model_config=embedding_model_config,
)
print(corpus)
# Example response:
# RagCorpus(name='projects/1234567890/locations/us-central1/ragCorpora/1234567890',
# display_name='test_corpus', description='Corpus Description', embedding_model_config=...
# ...

Response body

If successful, the response body contains a newly created instance of Operation.