index_service.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.cloud.aiplatform.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/aiplatform/v1beta1/index.proto";
  21. import "google/cloud/aiplatform/v1beta1/operation.proto";
  22. import "google/longrunning/operations.proto";
  23. import "google/protobuf/field_mask.proto";
  24. option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "IndexServiceProto";
  28. option java_package = "com.google.cloud.aiplatform.v1beta1";
  29. option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
  30. option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
  31. // A service for creating and managing Vertex AI's Index resources.
  32. service IndexService {
  33. option (google.api.default_host) = "aiplatform.googleapis.com";
  34. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  35. // Creates an Index.
  36. rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
  37. option (google.api.http) = {
  38. post: "/v1beta1/{parent=projects/*/locations/*}/indexes"
  39. body: "index"
  40. };
  41. option (google.api.method_signature) = "parent,index";
  42. option (google.longrunning.operation_info) = {
  43. response_type: "Index"
  44. metadata_type: "CreateIndexOperationMetadata"
  45. };
  46. }
  47. // Gets an Index.
  48. rpc GetIndex(GetIndexRequest) returns (Index) {
  49. option (google.api.http) = {
  50. get: "/v1beta1/{name=projects/*/locations/*/indexes/*}"
  51. };
  52. option (google.api.method_signature) = "name";
  53. }
  54. // Lists Indexes in a Location.
  55. rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
  56. option (google.api.http) = {
  57. get: "/v1beta1/{parent=projects/*/locations/*}/indexes"
  58. };
  59. option (google.api.method_signature) = "parent";
  60. }
  61. // Updates an Index.
  62. rpc UpdateIndex(UpdateIndexRequest) returns (google.longrunning.Operation) {
  63. option (google.api.http) = {
  64. patch: "/v1beta1/{index.name=projects/*/locations/*/indexes/*}"
  65. body: "index"
  66. };
  67. option (google.api.method_signature) = "index,update_mask";
  68. option (google.longrunning.operation_info) = {
  69. response_type: "Index"
  70. metadata_type: "UpdateIndexOperationMetadata"
  71. };
  72. }
  73. // Deletes an Index.
  74. // An Index can only be deleted when all its
  75. // [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes] had been undeployed.
  76. rpc DeleteIndex(DeleteIndexRequest) returns (google.longrunning.Operation) {
  77. option (google.api.http) = {
  78. delete: "/v1beta1/{name=projects/*/locations/*/indexes/*}"
  79. };
  80. option (google.api.method_signature) = "name";
  81. option (google.longrunning.operation_info) = {
  82. response_type: "google.protobuf.Empty"
  83. metadata_type: "DeleteOperationMetadata"
  84. };
  85. }
  86. // Add/update Datapoints into an Index.
  87. rpc UpsertDatapoints(UpsertDatapointsRequest) returns (UpsertDatapointsResponse) {
  88. option (google.api.http) = {
  89. post: "/v1beta1/{index=projects/*/locations/*/indexes/*}:upsertDatapoints"
  90. body: "*"
  91. };
  92. }
  93. // Remove Datapoints from an Index.
  94. rpc RemoveDatapoints(RemoveDatapointsRequest) returns (RemoveDatapointsResponse) {
  95. option (google.api.http) = {
  96. post: "/v1beta1/{index=projects/*/locations/*/indexes/*}:removeDatapoints"
  97. body: "*"
  98. };
  99. }
  100. }
  101. // Request message for [IndexService.CreateIndex][google.cloud.aiplatform.v1beta1.IndexService.CreateIndex].
  102. message CreateIndexRequest {
  103. // Required. The resource name of the Location to create the Index in.
  104. // Format: `projects/{project}/locations/{location}`
  105. string parent = 1 [
  106. (google.api.field_behavior) = REQUIRED,
  107. (google.api.resource_reference) = {
  108. type: "locations.googleapis.com/Location"
  109. }
  110. ];
  111. // Required. The Index to create.
  112. Index index = 2 [(google.api.field_behavior) = REQUIRED];
  113. }
  114. // Runtime operation information for [IndexService.CreateIndex][google.cloud.aiplatform.v1beta1.IndexService.CreateIndex].
  115. message CreateIndexOperationMetadata {
  116. // The operation generic information.
  117. GenericOperationMetadata generic_metadata = 1;
  118. // The operation metadata with regard to Matching Engine Index operation.
  119. NearestNeighborSearchOperationMetadata nearest_neighbor_search_operation_metadata = 2;
  120. }
  121. // Request message for [IndexService.GetIndex][google.cloud.aiplatform.v1beta1.IndexService.GetIndex]
  122. message GetIndexRequest {
  123. // Required. The name of the Index resource.
  124. // Format:
  125. // `projects/{project}/locations/{location}/indexes/{index}`
  126. string name = 1 [
  127. (google.api.field_behavior) = REQUIRED,
  128. (google.api.resource_reference) = {
  129. type: "aiplatform.googleapis.com/Index"
  130. }
  131. ];
  132. }
  133. // Request message for [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes].
  134. message ListIndexesRequest {
  135. // Required. The resource name of the Location from which to list the Indexes.
  136. // Format: `projects/{project}/locations/{location}`
  137. string parent = 1 [
  138. (google.api.field_behavior) = REQUIRED,
  139. (google.api.resource_reference) = {
  140. type: "locations.googleapis.com/Location"
  141. }
  142. ];
  143. // The standard list filter.
  144. string filter = 2;
  145. // The standard list page size.
  146. int32 page_size = 3;
  147. // The standard list page token.
  148. // Typically obtained via
  149. // [ListIndexesResponse.next_page_token][google.cloud.aiplatform.v1beta1.ListIndexesResponse.next_page_token] of the previous
  150. // [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes] call.
  151. string page_token = 4;
  152. // Mask specifying which fields to read.
  153. google.protobuf.FieldMask read_mask = 5;
  154. }
  155. // Response message for [IndexService.ListIndexes][google.cloud.aiplatform.v1beta1.IndexService.ListIndexes].
  156. message ListIndexesResponse {
  157. // List of indexes in the requested page.
  158. repeated Index indexes = 1;
  159. // A token to retrieve next page of results.
  160. // Pass to [ListIndexesRequest.page_token][google.cloud.aiplatform.v1beta1.ListIndexesRequest.page_token] to obtain that page.
  161. string next_page_token = 2;
  162. }
  163. // Request message for [IndexService.UpdateIndex][google.cloud.aiplatform.v1beta1.IndexService.UpdateIndex].
  164. message UpdateIndexRequest {
  165. // Required. The Index which updates the resource on the server.
  166. Index index = 1 [(google.api.field_behavior) = REQUIRED];
  167. // The update mask applies to the resource.
  168. // For the `FieldMask` definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask].
  169. google.protobuf.FieldMask update_mask = 2;
  170. }
  171. // Runtime operation information for [IndexService.UpdateIndex][google.cloud.aiplatform.v1beta1.IndexService.UpdateIndex].
  172. message UpdateIndexOperationMetadata {
  173. // The operation generic information.
  174. GenericOperationMetadata generic_metadata = 1;
  175. // The operation metadata with regard to Matching Engine Index operation.
  176. NearestNeighborSearchOperationMetadata nearest_neighbor_search_operation_metadata = 2;
  177. }
  178. // Request message for [IndexService.DeleteIndex][google.cloud.aiplatform.v1beta1.IndexService.DeleteIndex].
  179. message DeleteIndexRequest {
  180. // Required. The name of the Index resource to be deleted.
  181. // Format:
  182. // `projects/{project}/locations/{location}/indexes/{index}`
  183. string name = 1 [
  184. (google.api.field_behavior) = REQUIRED,
  185. (google.api.resource_reference) = {
  186. type: "aiplatform.googleapis.com/Index"
  187. }
  188. ];
  189. }
  190. // Request message for [IndexService.UpsertDatapoints][google.cloud.aiplatform.v1beta1.IndexService.UpsertDatapoints]
  191. message UpsertDatapointsRequest {
  192. // Required. The name of the Index resource to be updated.
  193. // Format:
  194. // `projects/{project}/locations/{location}/indexes/{index}`
  195. string index = 1 [
  196. (google.api.field_behavior) = REQUIRED,
  197. (google.api.resource_reference) = {
  198. type: "aiplatform.googleapis.com/Index"
  199. }
  200. ];
  201. // A list of datapoints to be created/updated.
  202. repeated IndexDatapoint datapoints = 2;
  203. }
  204. // Response message for [IndexService.UpsertDatapoints][google.cloud.aiplatform.v1beta1.IndexService.UpsertDatapoints]
  205. message UpsertDatapointsResponse {
  206. }
  207. // Request message for [IndexService.RemoveDatapoints][google.cloud.aiplatform.v1beta1.IndexService.RemoveDatapoints]
  208. message RemoveDatapointsRequest {
  209. // Required. The name of the Index resource to be updated.
  210. // Format:
  211. // `projects/{project}/locations/{location}/indexes/{index}`
  212. string index = 1 [
  213. (google.api.field_behavior) = REQUIRED,
  214. (google.api.resource_reference) = {
  215. type: "aiplatform.googleapis.com/Index"
  216. }
  217. ];
  218. // A list of datapoint ids to be deleted.
  219. repeated string datapoint_ids = 2;
  220. }
  221. // Response message for [IndexService.RemoveDatapoints][google.cloud.aiplatform.v1beta1.IndexService.RemoveDatapoints]
  222. message RemoveDatapointsResponse {
  223. }
  224. // Runtime operation metadata with regard to Matching Engine Index.
  225. message NearestNeighborSearchOperationMetadata {
  226. message RecordError {
  227. enum RecordErrorType {
  228. // Default, shall not be used.
  229. ERROR_TYPE_UNSPECIFIED = 0;
  230. // The record is empty.
  231. EMPTY_LINE = 1;
  232. // Invalid json format.
  233. INVALID_JSON_SYNTAX = 2;
  234. // Invalid csv format.
  235. INVALID_CSV_SYNTAX = 3;
  236. // Invalid avro format.
  237. INVALID_AVRO_SYNTAX = 4;
  238. // The embedding id is not valid.
  239. INVALID_EMBEDDING_ID = 5;
  240. // The size of the embedding vectors does not match with the specified
  241. // dimension.
  242. EMBEDDING_SIZE_MISMATCH = 6;
  243. // The `namespace` field is missing.
  244. NAMESPACE_MISSING = 7;
  245. }
  246. // The error type of this record.
  247. RecordErrorType error_type = 1;
  248. // A human-readable message that is shown to the user to help them fix the
  249. // error. Note that this message may change from time to time, your code
  250. // should check against error_type as the source of truth.
  251. string error_message = 2;
  252. // Cloud Storage URI pointing to the original file in user's bucket.
  253. string source_gcs_uri = 3;
  254. // Empty if the embedding id is failed to parse.
  255. string embedding_id = 4;
  256. // The original content of this record.
  257. string raw_record = 5;
  258. }
  259. message ContentValidationStats {
  260. // Cloud Storage URI pointing to the original file in user's bucket.
  261. string source_gcs_uri = 1;
  262. // Number of records in this file that were successfully processed.
  263. int64 valid_record_count = 2;
  264. // Number of records in this file we skipped due to validate errors.
  265. int64 invalid_record_count = 3;
  266. // The detail information of the partial failures encountered for those
  267. // invalid records that couldn't be parsed.
  268. // Up to 50 partial errors will be reported.
  269. repeated RecordError partial_errors = 4;
  270. }
  271. // The validation stats of the content (per file) to be inserted or
  272. // updated on the Matching Engine Index resource. Populated if
  273. // contentsDeltaUri is provided as part of [Index.metadata][google.cloud.aiplatform.v1beta1.Index.metadata]. Please note
  274. // that, currently for those files that are broken or has unsupported file
  275. // format, we will not have the stats for those files.
  276. repeated ContentValidationStats content_validation_stats = 1;
  277. // The ingested data size in bytes.
  278. int64 data_bytes_count = 2;
  279. }