xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1beta1/index_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/index.proto";
24import "google/cloud/aiplatform/v1beta1/operation.proto";
25import "google/longrunning/operations.proto";
26import "google/protobuf/empty.proto";
27import "google/protobuf/field_mask.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 = "IndexServiceProto";
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 creating and managing Vertex AI's Index resources.
38service IndexService {
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 an Index.
44  rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
45    option (google.api.http) = {
46      post: "/v1beta1/{parent=projects/*/locations/*}/indexes"
47      body: "index"
48    };
49    option (google.api.method_signature) = "parent,index";
50    option (google.longrunning.operation_info) = {
51      response_type: "Index"
52      metadata_type: "CreateIndexOperationMetadata"
53    };
54  }
55
56  // Gets an Index.
57  rpc GetIndex(GetIndexRequest) returns (Index) {
58    option (google.api.http) = {
59      get: "/v1beta1/{name=projects/*/locations/*/indexes/*}"
60    };
61    option (google.api.method_signature) = "name";
62  }
63
64  // Lists Indexes in a Location.
65  rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
66    option (google.api.http) = {
67      get: "/v1beta1/{parent=projects/*/locations/*}/indexes"
68    };
69    option (google.api.method_signature) = "parent";
70  }
71
72  // Updates an Index.
73  rpc UpdateIndex(UpdateIndexRequest) returns (google.longrunning.Operation) {
74    option (google.api.http) = {
75      patch: "/v1beta1/{index.name=projects/*/locations/*/indexes/*}"
76      body: "index"
77    };
78    option (google.api.method_signature) = "index,update_mask";
79    option (google.longrunning.operation_info) = {
80      response_type: "Index"
81      metadata_type: "UpdateIndexOperationMetadata"
82    };
83  }
84
85  // Deletes an Index.
86  // An Index can only be deleted when all its
87  // [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes]
88  // had been undeployed.
89  rpc DeleteIndex(DeleteIndexRequest) returns (google.longrunning.Operation) {
90    option (google.api.http) = {
91      delete: "/v1beta1/{name=projects/*/locations/*/indexes/*}"
92    };
93    option (google.api.method_signature) = "name";
94    option (google.longrunning.operation_info) = {
95      response_type: "google.protobuf.Empty"
96      metadata_type: "DeleteOperationMetadata"
97    };
98  }
99
100  // Add/update Datapoints into an Index.
101  rpc UpsertDatapoints(UpsertDatapointsRequest)
102      returns (UpsertDatapointsResponse) {
103    option (google.api.http) = {
104      post: "/v1beta1/{index=projects/*/locations/*/indexes/*}:upsertDatapoints"
105      body: "*"
106    };
107  }
108
109  // Remove Datapoints from an Index.
110  rpc RemoveDatapoints(RemoveDatapointsRequest)
111      returns (RemoveDatapointsResponse) {
112    option (google.api.http) = {
113      post: "/v1beta1/{index=projects/*/locations/*/indexes/*}:removeDatapoints"
114      body: "*"
115    };
116  }
117}
118
119// Request message for
120// [IndexService.CreateIndex][google.cloud.aiplatform.v1beta1.IndexService.CreateIndex].
121message CreateIndexRequest {
122  // Required. The resource name of the Location to create the Index in.
123  // Format: `projects/{project}/locations/{location}`
124  string parent = 1 [
125    (google.api.field_behavior) = REQUIRED,
126    (google.api.resource_reference) = {
127      type: "locations.googleapis.com/Location"
128    }
129  ];
130
131  // Required. The Index to create.
132  Index index = 2 [(google.api.field_behavior) = REQUIRED];
133}
134
135// Runtime operation information for
136// [IndexService.CreateIndex][google.cloud.aiplatform.v1beta1.IndexService.CreateIndex].
137message CreateIndexOperationMetadata {
138  // The operation generic information.
139  GenericOperationMetadata generic_metadata = 1;
140
141  // The operation metadata with regard to Matching Engine Index operation.
142  NearestNeighborSearchOperationMetadata
143      nearest_neighbor_search_operation_metadata = 2;
144}
145
146// Request message for
147// [IndexService.GetIndex][google.cloud.aiplatform.v1beta1.IndexService.GetIndex]
148message GetIndexRequest {
149  // Required. The name of the Index resource.
150  // Format:
151  // `projects/{project}/locations/{location}/indexes/{index}`
152  string name = 1 [
153    (google.api.field_behavior) = REQUIRED,
154    (google.api.resource_reference) = {
155      type: "aiplatform.googleapis.com/Index"
156    }
157  ];
158}
159
160// Request message for
161// [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes].
162message ListIndexesRequest {
163  // Required. The resource name of the Location from which to list the Indexes.
164  // Format: `projects/{project}/locations/{location}`
165  string parent = 1 [
166    (google.api.field_behavior) = REQUIRED,
167    (google.api.resource_reference) = {
168      type: "locations.googleapis.com/Location"
169    }
170  ];
171
172  // The standard list filter.
173  string filter = 2;
174
175  // The standard list page size.
176  int32 page_size = 3;
177
178  // The standard list page token.
179  // Typically obtained via
180  // [ListIndexesResponse.next_page_token][google.cloud.aiplatform.v1beta1.ListIndexesResponse.next_page_token]
181  // of the previous
182  // [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes]
183  // call.
184  string page_token = 4;
185
186  // Mask specifying which fields to read.
187  google.protobuf.FieldMask read_mask = 5;
188}
189
190// Response message for
191// [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes].
192message ListIndexesResponse {
193  // List of indexes in the requested page.
194  repeated Index indexes = 1;
195
196  // A token to retrieve next page of results.
197  // Pass to
198  // [ListIndexesRequest.page_token][google.cloud.aiplatform.v1beta1.ListIndexesRequest.page_token]
199  // to obtain that page.
200  string next_page_token = 2;
201}
202
203// Request message for
204// [IndexService.UpdateIndex][google.cloud.aiplatform.v1beta1.IndexService.UpdateIndex].
205message UpdateIndexRequest {
206  // Required. The Index which updates the resource on the server.
207  Index index = 1 [(google.api.field_behavior) = REQUIRED];
208
209  // The update mask applies to the resource.
210  // For the `FieldMask` definition, see
211  // [google.protobuf.FieldMask][google.protobuf.FieldMask].
212  google.protobuf.FieldMask update_mask = 2;
213}
214
215// Runtime operation information for
216// [IndexService.UpdateIndex][google.cloud.aiplatform.v1beta1.IndexService.UpdateIndex].
217message UpdateIndexOperationMetadata {
218  // The operation generic information.
219  GenericOperationMetadata generic_metadata = 1;
220
221  // The operation metadata with regard to Matching Engine Index operation.
222  NearestNeighborSearchOperationMetadata
223      nearest_neighbor_search_operation_metadata = 2;
224}
225
226// Request message for
227// [IndexService.DeleteIndex][google.cloud.aiplatform.v1beta1.IndexService.DeleteIndex].
228message DeleteIndexRequest {
229  // Required. The name of the Index resource to be deleted.
230  // Format:
231  // `projects/{project}/locations/{location}/indexes/{index}`
232  string name = 1 [
233    (google.api.field_behavior) = REQUIRED,
234    (google.api.resource_reference) = {
235      type: "aiplatform.googleapis.com/Index"
236    }
237  ];
238}
239
240// Request message for
241// [IndexService.UpsertDatapoints][google.cloud.aiplatform.v1beta1.IndexService.UpsertDatapoints]
242message UpsertDatapointsRequest {
243  // Required. The name of the Index resource to be updated.
244  // Format:
245  // `projects/{project}/locations/{location}/indexes/{index}`
246  string index = 1 [
247    (google.api.field_behavior) = REQUIRED,
248    (google.api.resource_reference) = {
249      type: "aiplatform.googleapis.com/Index"
250    }
251  ];
252
253  // A list of datapoints to be created/updated.
254  repeated IndexDatapoint datapoints = 2;
255
256  // Optional. Update mask is used to specify the fields to be overwritten in
257  // the datapoints by the update. The fields specified in the update_mask are
258  // relative to each IndexDatapoint inside datapoints, not the full request.
259  //
260  // Updatable fields:
261  //
262  //   * Use `all_restricts` to update both restricts and numeric_restricts.
263  google.protobuf.FieldMask update_mask = 3
264      [(google.api.field_behavior) = OPTIONAL];
265}
266
267// Response message for
268// [IndexService.UpsertDatapoints][google.cloud.aiplatform.v1beta1.IndexService.UpsertDatapoints]
269message UpsertDatapointsResponse {}
270
271// Request message for
272// [IndexService.RemoveDatapoints][google.cloud.aiplatform.v1beta1.IndexService.RemoveDatapoints]
273message RemoveDatapointsRequest {
274  // Required. The name of the Index resource to be updated.
275  // Format:
276  // `projects/{project}/locations/{location}/indexes/{index}`
277  string index = 1 [
278    (google.api.field_behavior) = REQUIRED,
279    (google.api.resource_reference) = {
280      type: "aiplatform.googleapis.com/Index"
281    }
282  ];
283
284  // A list of datapoint ids to be deleted.
285  repeated string datapoint_ids = 2;
286}
287
288// Response message for
289// [IndexService.RemoveDatapoints][google.cloud.aiplatform.v1beta1.IndexService.RemoveDatapoints]
290message RemoveDatapointsResponse {}
291
292// Runtime operation metadata with regard to Matching Engine Index.
293message NearestNeighborSearchOperationMetadata {
294  message RecordError {
295    enum RecordErrorType {
296      // Default, shall not be used.
297      ERROR_TYPE_UNSPECIFIED = 0;
298
299      // The record is empty.
300      EMPTY_LINE = 1;
301
302      // Invalid json format.
303      INVALID_JSON_SYNTAX = 2;
304
305      // Invalid csv format.
306      INVALID_CSV_SYNTAX = 3;
307
308      // Invalid avro format.
309      INVALID_AVRO_SYNTAX = 4;
310
311      // The embedding id is not valid.
312      INVALID_EMBEDDING_ID = 5;
313
314      // The size of the embedding vectors does not match with the specified
315      // dimension.
316      EMBEDDING_SIZE_MISMATCH = 6;
317
318      // The `namespace` field is missing.
319      NAMESPACE_MISSING = 7;
320
321      // Generic catch-all error. Only used for validation failure where the
322      // root cause cannot be easily retrieved programmatically.
323      PARSING_ERROR = 8;
324
325      // There are multiple restricts with the same `namespace` value.
326      DUPLICATE_NAMESPACE = 9;
327
328      // Numeric restrict has operator specified in datapoint.
329      OP_IN_DATAPOINT = 10;
330
331      // Numeric restrict has multiple values specified.
332      MULTIPLE_VALUES = 11;
333
334      // Numeric restrict has invalid numeric value specified.
335      INVALID_NUMERIC_VALUE = 12;
336
337      // File is not in UTF_8 format.
338      INVALID_ENCODING = 13;
339    }
340
341    // The error type of this record.
342    RecordErrorType error_type = 1;
343
344    // A human-readable message that is shown to the user to help them fix the
345    // error. Note that this message may change from time to time, your code
346    // should check against error_type as the source of truth.
347    string error_message = 2;
348
349    // Cloud Storage URI pointing to the original file in user's bucket.
350    string source_gcs_uri = 3;
351
352    // Empty if the embedding id is failed to parse.
353    string embedding_id = 4;
354
355    // The original content of this record.
356    string raw_record = 5;
357  }
358
359  message ContentValidationStats {
360    // Cloud Storage URI pointing to the original file in user's bucket.
361    string source_gcs_uri = 1;
362
363    // Number of records in this file that were successfully processed.
364    int64 valid_record_count = 2;
365
366    // Number of records in this file we skipped due to validate errors.
367    int64 invalid_record_count = 3;
368
369    // The detail information of the partial failures encountered for those
370    // invalid records that couldn't be parsed.
371    // Up to 50 partial errors will be reported.
372    repeated RecordError partial_errors = 4;
373  }
374
375  // The validation stats of the content (per file) to be inserted or
376  // updated on the Matching Engine Index resource. Populated if
377  // contentsDeltaUri is provided as part of
378  // [Index.metadata][google.cloud.aiplatform.v1beta1.Index.metadata]. Please
379  // note that, currently for those files that are broken or has unsupported
380  // file format, we will not have the stats for those files.
381  repeated ContentValidationStats content_validation_stats = 1;
382
383  // The ingested data size in bytes.
384  int64 data_bytes_count = 2;
385}
386