1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.aiplatform.v1beta1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/aiplatform/v1beta1/operation.proto"; 24import "google/cloud/aiplatform/v1beta1/vertex_rag_data.proto"; 25import "google/longrunning/operations.proto"; 26import "google/protobuf/empty.proto"; 27import "google/rpc/status.proto"; 28 29option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1"; 30option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb"; 31option java_multiple_files = true; 32option java_outer_classname = "VertexRagDataServiceProto"; 33option java_package = "com.google.cloud.aiplatform.v1beta1"; 34option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1"; 35option ruby_package = "Google::Cloud::AIPlatform::V1beta1"; 36 37// A service for managing user data for RAG. 38service VertexRagDataService { 39 option (google.api.default_host) = "aiplatform.googleapis.com"; 40 option (google.api.oauth_scopes) = 41 "https://www.googleapis.com/auth/cloud-platform"; 42 43 // Creates a RagCorpus. 44 rpc CreateRagCorpus(CreateRagCorpusRequest) 45 returns (google.longrunning.Operation) { 46 option (google.api.http) = { 47 post: "/v1beta1/{parent=projects/*/locations/*}/ragCorpora" 48 body: "rag_corpus" 49 }; 50 option (google.api.method_signature) = "parent,rag_corpus"; 51 option (google.longrunning.operation_info) = { 52 response_type: "RagCorpus" 53 metadata_type: "CreateRagCorpusOperationMetadata" 54 }; 55 } 56 57 // Gets a RagCorpus. 58 rpc GetRagCorpus(GetRagCorpusRequest) returns (RagCorpus) { 59 option (google.api.http) = { 60 get: "/v1beta1/{name=projects/*/locations/*/ragCorpora/*}" 61 }; 62 option (google.api.method_signature) = "name"; 63 } 64 65 // Lists RagCorpora in a Location. 66 rpc ListRagCorpora(ListRagCorporaRequest) returns (ListRagCorporaResponse) { 67 option (google.api.http) = { 68 get: "/v1beta1/{parent=projects/*/locations/*}/ragCorpora" 69 }; 70 option (google.api.method_signature) = "parent"; 71 } 72 73 // Deletes a RagCorpus. 74 rpc DeleteRagCorpus(DeleteRagCorpusRequest) 75 returns (google.longrunning.Operation) { 76 option (google.api.http) = { 77 delete: "/v1beta1/{name=projects/*/locations/*/ragCorpora/*}" 78 }; 79 option (google.api.method_signature) = "name"; 80 option (google.longrunning.operation_info) = { 81 response_type: "google.protobuf.Empty" 82 metadata_type: "DeleteOperationMetadata" 83 }; 84 } 85 86 // Upload a file into a RagCorpus. 87 rpc UploadRagFile(UploadRagFileRequest) returns (UploadRagFileResponse) { 88 option (google.api.http) = { 89 post: "/v1beta1/{parent=projects/*/locations/*/ragCorpora/*}/ragFiles:upload" 90 body: "*" 91 }; 92 option (google.api.method_signature) = 93 "parent,rag_file,upload_rag_file_config"; 94 } 95 96 // Import files from Google Cloud Storage or Google Drive into a RagCorpus. 97 rpc ImportRagFiles(ImportRagFilesRequest) 98 returns (google.longrunning.Operation) { 99 option (google.api.http) = { 100 post: "/v1beta1/{parent=projects/*/locations/*/ragCorpora/*}/ragFiles:import" 101 body: "*" 102 }; 103 option (google.api.method_signature) = "parent,import_rag_files_config"; 104 option (google.longrunning.operation_info) = { 105 response_type: "ImportRagFilesResponse" 106 metadata_type: "ImportRagFilesOperationMetadata" 107 }; 108 } 109 110 // Gets a RagFile. 111 rpc GetRagFile(GetRagFileRequest) returns (RagFile) { 112 option (google.api.http) = { 113 get: "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*}" 114 }; 115 option (google.api.method_signature) = "name"; 116 } 117 118 // Lists RagFiles in a RagCorpus. 119 rpc ListRagFiles(ListRagFilesRequest) returns (ListRagFilesResponse) { 120 option (google.api.http) = { 121 get: "/v1beta1/{parent=projects/*/locations/*/ragCorpora/*}/ragFiles" 122 }; 123 option (google.api.method_signature) = "parent"; 124 } 125 126 // Deletes a RagFile. 127 rpc DeleteRagFile(DeleteRagFileRequest) 128 returns (google.longrunning.Operation) { 129 option (google.api.http) = { 130 delete: "/v1beta1/{name=projects/*/locations/*/ragCorpora/*/ragFiles/*}" 131 }; 132 option (google.api.method_signature) = "name"; 133 option (google.longrunning.operation_info) = { 134 response_type: "google.protobuf.Empty" 135 metadata_type: "DeleteOperationMetadata" 136 }; 137 } 138} 139 140// Request message for 141// [VertexRagDataService.CreateRagCorpus][google.cloud.aiplatform.v1beta1.VertexRagDataService.CreateRagCorpus]. 142message CreateRagCorpusRequest { 143 // Required. The resource name of the Location to create the RagCorpus in. 144 // Format: `projects/{project}/locations/{location}` 145 string parent = 1 [ 146 (google.api.field_behavior) = REQUIRED, 147 (google.api.resource_reference) = { 148 type: "locations.googleapis.com/Location" 149 } 150 ]; 151 152 // Required. The RagCorpus to create. 153 RagCorpus rag_corpus = 2 [(google.api.field_behavior) = REQUIRED]; 154} 155 156// Request message for 157// [VertexRagDataService.GetRagCorpus][google.cloud.aiplatform.v1beta1.VertexRagDataService.GetRagCorpus] 158message GetRagCorpusRequest { 159 // Required. The name of the RagCorpus resource. 160 // Format: 161 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` 162 string name = 1 [ 163 (google.api.field_behavior) = REQUIRED, 164 (google.api.resource_reference) = { 165 type: "aiplatform.googleapis.com/RagCorpus" 166 } 167 ]; 168} 169 170// Request message for 171// [VertexRagDataService.ListRagCorpora][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagCorpora]. 172message ListRagCorporaRequest { 173 // Required. The resource name of the Location from which to list the 174 // RagCorpora. Format: `projects/{project}/locations/{location}` 175 string parent = 1 [ 176 (google.api.field_behavior) = REQUIRED, 177 (google.api.resource_reference) = { 178 type: "locations.googleapis.com/Location" 179 } 180 ]; 181 182 // Optional. The standard list page size. 183 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 184 185 // Optional. The standard list page token. 186 // Typically obtained via 187 // [ListRagCorporaResponse.next_page_token][google.cloud.aiplatform.v1beta1.ListRagCorporaResponse.next_page_token] 188 // of the previous 189 // [VertexRagDataService.ListRagCorpora][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagCorpora] 190 // call. 191 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 192} 193 194// Response message for 195// [VertexRagDataService.ListRagCorpora][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagCorpora]. 196message ListRagCorporaResponse { 197 // List of RagCorpora in the requested page. 198 repeated RagCorpus rag_corpora = 1; 199 200 // A token to retrieve the next page of results. 201 // Pass to 202 // [ListRagCorporaRequest.page_token][google.cloud.aiplatform.v1beta1.ListRagCorporaRequest.page_token] 203 // to obtain that page. 204 string next_page_token = 2; 205} 206 207// Request message for 208// [VertexRagDataService.DeleteRagCorpus][google.cloud.aiplatform.v1beta1.VertexRagDataService.DeleteRagCorpus]. 209message DeleteRagCorpusRequest { 210 // Required. The name of the RagCorpus resource to be deleted. 211 // Format: 212 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` 213 string name = 1 [ 214 (google.api.field_behavior) = REQUIRED, 215 (google.api.resource_reference) = { 216 type: "aiplatform.googleapis.com/RagCorpus" 217 } 218 ]; 219 220 // Optional. If set to true, any RagFiles in this RagCorpus will also be 221 // deleted. Otherwise, the request will only work if the RagCorpus has no 222 // RagFiles. 223 bool force = 2 [(google.api.field_behavior) = OPTIONAL]; 224} 225 226// Request message for 227// [VertexRagDataService.UploadRagFile][google.cloud.aiplatform.v1beta1.VertexRagDataService.UploadRagFile]. 228message UploadRagFileRequest { 229 // Required. The name of the RagCorpus resource into which to upload the file. 230 // Format: 231 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` 232 string parent = 1 [ 233 (google.api.field_behavior) = REQUIRED, 234 (google.api.resource_reference) = { 235 type: "aiplatform.googleapis.com/RagCorpus" 236 } 237 ]; 238 239 // Required. The RagFile to upload. 240 RagFile rag_file = 2 [(google.api.field_behavior) = REQUIRED]; 241 242 // Required. The config for the RagFiles to be uploaded into the RagCorpus. 243 // [VertexRagDataService.UploadRagFile][google.cloud.aiplatform.v1beta1.VertexRagDataService.UploadRagFile]. 244 UploadRagFileConfig upload_rag_file_config = 5 245 [(google.api.field_behavior) = REQUIRED]; 246} 247 248// Response message for 249// [VertexRagDataService.UploadRagFile][google.cloud.aiplatform.v1beta1.VertexRagDataService.UploadRagFile]. 250message UploadRagFileResponse { 251 oneof result { 252 // The RagFile that had been uploaded into the RagCorpus. 253 RagFile rag_file = 1; 254 255 // The error that occurred while processing the RagFile. 256 google.rpc.Status error = 4; 257 } 258} 259 260// Request message for 261// [VertexRagDataService.ImportRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ImportRagFiles]. 262message ImportRagFilesRequest { 263 // Required. The name of the RagCorpus resource into which to import files. 264 // Format: 265 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` 266 string parent = 1 [ 267 (google.api.field_behavior) = REQUIRED, 268 (google.api.resource_reference) = { 269 type: "aiplatform.googleapis.com/RagCorpus" 270 } 271 ]; 272 273 // Required. The config for the RagFiles to be synced and imported into the 274 // RagCorpus. 275 // [VertexRagDataService.ImportRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ImportRagFiles]. 276 ImportRagFilesConfig import_rag_files_config = 2 277 [(google.api.field_behavior) = REQUIRED]; 278} 279 280// Response message for 281// [VertexRagDataService.ImportRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ImportRagFiles]. 282message ImportRagFilesResponse { 283 // The number of RagFiles that had been imported into the RagCorpus. 284 int64 imported_rag_files_count = 1; 285} 286 287// Request message for 288// [VertexRagDataService.GetRagFile][google.cloud.aiplatform.v1beta1.VertexRagDataService.GetRagFile] 289message GetRagFileRequest { 290 // Required. The name of the RagFile resource. 291 // Format: 292 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}/ragFiles/{rag_file}` 293 string name = 1 [ 294 (google.api.field_behavior) = REQUIRED, 295 (google.api.resource_reference) = { 296 type: "aiplatform.googleapis.com/RagFile" 297 } 298 ]; 299} 300 301// Request message for 302// [VertexRagDataService.ListRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagFiles]. 303message ListRagFilesRequest { 304 // Required. The resource name of the RagCorpus from which to list the 305 // RagFiles. Format: 306 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}` 307 string parent = 1 [ 308 (google.api.field_behavior) = REQUIRED, 309 (google.api.resource_reference) = { 310 type: "aiplatform.googleapis.com/RagCorpus" 311 } 312 ]; 313 314 // Optional. The standard list page size. 315 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 316 317 // Optional. The standard list page token. 318 // Typically obtained via 319 // [ListRagFilesResponse.next_page_token][google.cloud.aiplatform.v1beta1.ListRagFilesResponse.next_page_token] 320 // of the previous 321 // [VertexRagDataService.ListRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagFiles] 322 // call. 323 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 324} 325 326// Response message for 327// [VertexRagDataService.ListRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ListRagFiles]. 328message ListRagFilesResponse { 329 // List of RagFiles in the requested page. 330 repeated RagFile rag_files = 1; 331 332 // A token to retrieve the next page of results. 333 // Pass to 334 // [ListRagFilesRequest.page_token][google.cloud.aiplatform.v1beta1.ListRagFilesRequest.page_token] 335 // to obtain that page. 336 string next_page_token = 2; 337} 338 339// Request message for 340// [VertexRagDataService.DeleteRagFile][google.cloud.aiplatform.v1beta1.VertexRagDataService.DeleteRagFile]. 341message DeleteRagFileRequest { 342 // Required. The name of the RagFile resource to be deleted. 343 // Format: 344 // `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}/ragFiles/{rag_file}` 345 string name = 1 [ 346 (google.api.field_behavior) = REQUIRED, 347 (google.api.resource_reference) = { 348 type: "aiplatform.googleapis.com/RagFile" 349 } 350 ]; 351} 352 353// Runtime operation information for 354// [VertexRagDataService.CreateRagCorpus][google.cloud.aiplatform.v1beta1.VertexRagDataService.CreateRagCorpus]. 355message CreateRagCorpusOperationMetadata { 356 // The operation generic information. 357 GenericOperationMetadata generic_metadata = 1; 358} 359 360// Runtime operation information for 361// [VertexRagDataService.ImportRagFiles][google.cloud.aiplatform.v1beta1.VertexRagDataService.ImportRagFiles]. 362message ImportRagFilesOperationMetadata { 363 // The operation generic information. 364 GenericOperationMetadata generic_metadata = 1; 365 366 // The resource ID of RagCorpus that this operation is executed on. 367 int64 rag_corpus_id = 2; 368} 369