index.proto 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/aiplatform/v1beta1/deployed_index_ref.proto";
  19. import "google/protobuf/struct.proto";
  20. import "google/protobuf/timestamp.proto";
  21. option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "IndexProto";
  25. option java_package = "com.google.cloud.aiplatform.v1beta1";
  26. option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
  27. option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
  28. // A representation of a collection of database items organized in a way that
  29. // allows for approximate nearest neighbor (a.k.a ANN) algorithms search.
  30. message Index {
  31. option (google.api.resource) = {
  32. type: "aiplatform.googleapis.com/Index"
  33. pattern: "projects/{project}/locations/{location}/indexes/{index}"
  34. };
  35. // The update method of an Index.
  36. enum IndexUpdateMethod {
  37. // Should not be used.
  38. INDEX_UPDATE_METHOD_UNSPECIFIED = 0;
  39. // BatchUpdate: user can call UpdateIndex with files on Cloud Storage of
  40. // datapoints to update.
  41. BATCH_UPDATE = 1;
  42. // StreamUpdate: user can call UpsertDatapoints/DeleteDatapoints to update
  43. // the Index and the updates will be applied in corresponding
  44. // DeployedIndexes in nearly real-time.
  45. STREAM_UPDATE = 2;
  46. }
  47. // Output only. The resource name of the Index.
  48. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  49. // Required. The display name of the Index.
  50. // The name can be up to 128 characters long and can be consist of any UTF-8
  51. // characters.
  52. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  53. // The description of the Index.
  54. string description = 3;
  55. // Immutable. Points to a YAML file stored on Google Cloud Storage describing additional
  56. // information about the Index, that is specific to it. Unset if the Index
  57. // does not have any additional information.
  58. // The schema is defined as an OpenAPI 3.0.2 [Schema
  59. // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
  60. // Note: The URI given on output will be immutable and probably different,
  61. // including the URI scheme, than the one given on input. The output URI will
  62. // point to a location where the user only has a read access.
  63. string metadata_schema_uri = 4 [(google.api.field_behavior) = IMMUTABLE];
  64. // An additional information about the Index; the schema of the metadata can
  65. // be found in [metadata_schema][google.cloud.aiplatform.v1beta1.Index.metadata_schema_uri].
  66. google.protobuf.Value metadata = 6;
  67. // Output only. The pointers to DeployedIndexes created from this Index.
  68. // An Index can be only deleted if all its DeployedIndexes had been undeployed
  69. // first.
  70. repeated DeployedIndexRef deployed_indexes = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  71. // Used to perform consistent read-modify-write updates. If not set, a blind
  72. // "overwrite" update happens.
  73. string etag = 8;
  74. // The labels with user-defined metadata to organize your Indexes.
  75. //
  76. // Label keys and values can be no longer than 64 characters
  77. // (Unicode codepoints), can only contain lowercase letters, numeric
  78. // characters, underscores and dashes. International characters are allowed.
  79. //
  80. // See https://goo.gl/xmQnxf for more information and examples of labels.
  81. map<string, string> labels = 9;
  82. // Output only. Timestamp when this Index was created.
  83. google.protobuf.Timestamp create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  84. // Output only. Timestamp when this Index was most recently updated.
  85. // This also includes any update to the contents of the Index.
  86. // Note that Operations working on this Index may have their
  87. // [Operations.metadata.generic_metadata.update_time]
  88. // [google.cloud.aiplatform.v1beta1.GenericOperationMetadata.update_time] a little after the value of this
  89. // timestamp, yet that does not mean their results are not already reflected
  90. // in the Index. Result of any successfully completed Operation on the Index
  91. // is reflected in it.
  92. google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  93. // Output only. Stats of the index resource.
  94. IndexStats index_stats = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
  95. // Immutable. The update method to use with this Index. If not set, BATCH_UPDATE will be
  96. // used by default.
  97. IndexUpdateMethod index_update_method = 16 [(google.api.field_behavior) = IMMUTABLE];
  98. }
  99. // A datapoint of Index.
  100. message IndexDatapoint {
  101. // Restriction of a datapoint which describe its attributes(tokens) from each
  102. // of several attribute categories(namespaces).
  103. message Restriction {
  104. // The namespace of this restriction. eg: color.
  105. string namespace = 1;
  106. // The attributes to allow in this namespace. eg: 'red'
  107. repeated string allow_list = 2;
  108. // The attributes to deny in this namespace. eg: 'blue'
  109. repeated string deny_list = 3;
  110. }
  111. // Crowding tag is a constraint on a neighbor list produced by nearest
  112. // neighbor search requiring that no more than some value k' of the k
  113. // neighbors returned have the same value of crowding_attribute.
  114. message CrowdingTag {
  115. // The attribute value used for crowding. The maximum number of neighbors
  116. // to return per crowding attribute value
  117. // (per_crowding_attribute_num_neighbors) is configured per-query. This
  118. // field is ignored if per_crowding_attribute_num_neighbors is larger than
  119. // the total number of neighbors to return for a given query.
  120. string crowding_attribute = 1;
  121. }
  122. // Required. Unique identifier of the datapoint.
  123. string datapoint_id = 1 [(google.api.field_behavior) = REQUIRED];
  124. // Required. Feature embedding vector. An array of numbers with the length of
  125. // [NearestNeighborSearchConfig.dimensions].
  126. repeated float feature_vector = 2 [(google.api.field_behavior) = REQUIRED];
  127. // Optional. List of Restrict of the datapoint, used to perform "restricted searches"
  128. // where boolean rule are used to filter the subset of the database eligible
  129. // for matching.
  130. // See: https://cloud.google.com/vertex-ai/docs/matching-engine/filtering
  131. repeated Restriction restricts = 4 [(google.api.field_behavior) = OPTIONAL];
  132. // Optional. CrowdingTag of the datapoint, the number of neighbors to return in each
  133. // crowding can be configured during query.
  134. CrowdingTag crowding_tag = 5 [(google.api.field_behavior) = OPTIONAL];
  135. }
  136. // Stats of the Index.
  137. message IndexStats {
  138. // Output only. The number of vectors in the Index.
  139. int64 vectors_count = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  140. // Output only. The number of shards in the Index.
  141. int32 shards_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  142. }