featurestore_online_service.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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.v1;
  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/v1/feature_selector.proto";
  21. import "google/cloud/aiplatform/v1/types.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option csharp_namespace = "Google.Cloud.AIPlatform.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1;aiplatform";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "FeaturestoreOnlineServiceProto";
  27. option java_package = "com.google.cloud.aiplatform.v1";
  28. option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
  29. option ruby_package = "Google::Cloud::AIPlatform::V1";
  30. // A service for serving online feature values.
  31. service FeaturestoreOnlineServingService {
  32. option (google.api.default_host) = "aiplatform.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Reads Feature values of a specific entity of an EntityType. For reading
  35. // feature values of multiple entities of an EntityType, please use
  36. // StreamingReadFeatureValues.
  37. rpc ReadFeatureValues(ReadFeatureValuesRequest) returns (ReadFeatureValuesResponse) {
  38. option (google.api.http) = {
  39. post: "/v1/{entity_type=projects/*/locations/*/featurestores/*/entityTypes/*}:readFeatureValues"
  40. body: "*"
  41. };
  42. option (google.api.method_signature) = "entity_type";
  43. }
  44. // Reads Feature values for multiple entities. Depending on their size, data
  45. // for different entities may be broken
  46. // up across multiple responses.
  47. rpc StreamingReadFeatureValues(StreamingReadFeatureValuesRequest) returns (stream ReadFeatureValuesResponse) {
  48. option (google.api.http) = {
  49. post: "/v1/{entity_type=projects/*/locations/*/featurestores/*/entityTypes/*}:streamingReadFeatureValues"
  50. body: "*"
  51. };
  52. option (google.api.method_signature) = "entity_type";
  53. }
  54. }
  55. // Request message for [FeaturestoreOnlineServingService.ReadFeatureValues][google.cloud.aiplatform.v1.FeaturestoreOnlineServingService.ReadFeatureValues].
  56. message ReadFeatureValuesRequest {
  57. // Required. The resource name of the EntityType for the entity being read.
  58. // Value format:
  59. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  60. // For example, for a machine learning model predicting user clicks on a
  61. // website, an EntityType ID could be `user`.
  62. string entity_type = 1 [
  63. (google.api.field_behavior) = REQUIRED,
  64. (google.api.resource_reference) = {
  65. type: "aiplatform.googleapis.com/EntityType"
  66. }
  67. ];
  68. // Required. ID for a specific entity. For example,
  69. // for a machine learning model predicting user clicks on a website, an entity
  70. // ID could be `user_123`.
  71. string entity_id = 2 [(google.api.field_behavior) = REQUIRED];
  72. // Required. Selector choosing Features of the target EntityType.
  73. FeatureSelector feature_selector = 3 [(google.api.field_behavior) = REQUIRED];
  74. }
  75. // Response message for [FeaturestoreOnlineServingService.ReadFeatureValues][google.cloud.aiplatform.v1.FeaturestoreOnlineServingService.ReadFeatureValues].
  76. message ReadFeatureValuesResponse {
  77. // Metadata for requested Features.
  78. message FeatureDescriptor {
  79. // Feature ID.
  80. string id = 1;
  81. }
  82. // Response header with metadata for the requested
  83. // [ReadFeatureValuesRequest.entity_type][google.cloud.aiplatform.v1.ReadFeatureValuesRequest.entity_type] and Features.
  84. message Header {
  85. // The resource name of the EntityType from the
  86. // [ReadFeatureValuesRequest][google.cloud.aiplatform.v1.ReadFeatureValuesRequest]. Value format:
  87. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  88. string entity_type = 1 [(google.api.resource_reference) = {
  89. type: "aiplatform.googleapis.com/EntityType"
  90. }];
  91. // List of Feature metadata corresponding to each piece of
  92. // [ReadFeatureValuesResponse.data][].
  93. repeated FeatureDescriptor feature_descriptors = 2;
  94. }
  95. // Entity view with Feature values.
  96. message EntityView {
  97. // Container to hold value(s), successive in time, for one Feature from the
  98. // request.
  99. message Data {
  100. oneof data {
  101. // Feature value if a single value is requested.
  102. FeatureValue value = 1;
  103. // Feature values list if values, successive in time, are requested.
  104. // If the requested number of values is greater than the number of
  105. // existing Feature values, nonexistent values are omitted instead of
  106. // being returned as empty.
  107. FeatureValueList values = 2;
  108. }
  109. }
  110. // ID of the requested entity.
  111. string entity_id = 1;
  112. // Each piece of data holds the k
  113. // requested values for one requested Feature. If no values
  114. // for the requested Feature exist, the corresponding cell will be empty.
  115. // This has the same size and is in the same order as the features from the
  116. // header [ReadFeatureValuesResponse.header][google.cloud.aiplatform.v1.ReadFeatureValuesResponse.header].
  117. repeated Data data = 2;
  118. }
  119. // Response header.
  120. Header header = 1;
  121. // Entity view with Feature values. This may be the entity in the
  122. // Featurestore if values for all Features were requested, or a projection
  123. // of the entity in the Featurestore if values for only some Features were
  124. // requested.
  125. EntityView entity_view = 2;
  126. }
  127. // Request message for
  128. // [FeaturestoreOnlineServingService.StreamingFeatureValuesRead][].
  129. message StreamingReadFeatureValuesRequest {
  130. // Required. The resource name of the entities' type.
  131. // Value format:
  132. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  133. // For example,
  134. // for a machine learning model predicting user clicks on a website, an
  135. // EntityType ID could be `user`.
  136. string entity_type = 1 [
  137. (google.api.field_behavior) = REQUIRED,
  138. (google.api.resource_reference) = {
  139. type: "aiplatform.googleapis.com/EntityType"
  140. }
  141. ];
  142. // Required. IDs of entities to read Feature values of. The maximum number of IDs is
  143. // 100. For example, for a machine learning model predicting user clicks on a
  144. // website, an entity ID could be `user_123`.
  145. repeated string entity_ids = 2 [(google.api.field_behavior) = REQUIRED];
  146. // Required. Selector choosing Features of the target EntityType. Feature IDs will be
  147. // deduplicated.
  148. FeatureSelector feature_selector = 3 [(google.api.field_behavior) = REQUIRED];
  149. }
  150. // Value for a feature.
  151. message FeatureValue {
  152. // Metadata of feature value.
  153. message Metadata {
  154. // Feature generation timestamp. Typically, it is provided by user at
  155. // feature ingestion time. If not, feature store
  156. // will use the system timestamp when the data is ingested into feature
  157. // store. For streaming ingestion, the time, aligned by days, must be no
  158. // older than five years (1825 days) and no later than one year (366 days)
  159. // in the future.
  160. google.protobuf.Timestamp generate_time = 1;
  161. }
  162. // Value for the feature.
  163. oneof value {
  164. // Bool type feature value.
  165. bool bool_value = 1;
  166. // Double type feature value.
  167. double double_value = 2;
  168. // Int64 feature value.
  169. int64 int64_value = 5;
  170. // String feature value.
  171. string string_value = 6;
  172. // A list of bool type feature value.
  173. BoolArray bool_array_value = 7;
  174. // A list of double type feature value.
  175. DoubleArray double_array_value = 8;
  176. // A list of int64 type feature value.
  177. Int64Array int64_array_value = 11;
  178. // A list of string type feature value.
  179. StringArray string_array_value = 12;
  180. // Bytes feature value.
  181. bytes bytes_value = 13;
  182. }
  183. // Metadata of feature value.
  184. Metadata metadata = 14;
  185. }
  186. // Container for list of values.
  187. message FeatureValueList {
  188. // A list of feature values. All of them should be the same data type.
  189. repeated FeatureValue values = 1;
  190. }