Using Cloudrun to update your Vertex AI RAG
In this example, we are going to use Google cloud run to update corpus Vertex AI RAG. So when we have a new document, we load it up into Cloud storage. This generates an event for Cloud Run and update RAG. To setup our Cloud run with event trigger. We will give it a name and then configure the target resource name. As you can see we are using "tgoogle.cloud.storage.object.v1.finalized" which gets fired when we create a new object, or overwrite an existing object, and Cloud Storage creates a new generation of that object. This is code in our cloud run. import functions_framework import os from google.cloud import aiplatform from vertexai.preview import rag import vertexai # Configuration from Environment Variables PROJECT_ID = os.environ.get( "PROJECT_ID" ) LOCATION = os.environ.get( "LOCATION" , "us-central1" ) RAG_CORPUS_ID = os.environ.get( "RAG_CORPUS_ID" ) vertexai.init(project=PROJECT_ID, location=LOCATION) # Triggered by a...