featurestore_online_service.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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/feature_selector.proto";
  21. import "google/cloud/aiplatform/v1beta1/types.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "FeaturestoreOnlineServiceProto";
  27. option java_package = "com.google.cloud.aiplatform.v1beta1";
  28. option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
  29. option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
  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: "/v1beta1/{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: "/v1beta1/{entity_type=projects/*/locations/*/featurestores/*/entityTypes/*}:streamingReadFeatureValues"
  50. body: "*"
  51. };
  52. option (google.api.method_signature) = "entity_type";
  53. }
  54. // Writes Feature values of one or more entities of an EntityType.
  55. //
  56. // The Feature values are merged into existing entities if any. The Feature
  57. // values to be written must have timestamp within the online storage
  58. // retention.
  59. rpc WriteFeatureValues(WriteFeatureValuesRequest) returns (WriteFeatureValuesResponse) {
  60. option (google.api.http) = {
  61. post: "/v1beta1/{entity_type=projects/*/locations/*/featurestores/*/entityTypes/*}:writeFeatureValues"
  62. body: "*"
  63. };
  64. option (google.api.method_signature) = "entity_type,payloads";
  65. }
  66. }
  67. // Request message for [FeaturestoreOnlineServingService.WriteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService.WriteFeatureValues].
  68. message WriteFeatureValuesRequest {
  69. // Required. The resource name of the EntityType for the entities being written.
  70. // Value format: `projects/{project}/locations/{location}/featurestores/
  71. // {featurestore}/entityTypes/{entityType}`. For example,
  72. // for a machine learning model predicting user clicks on a website, an
  73. // EntityType ID could be `user`.
  74. string entity_type = 1 [
  75. (google.api.field_behavior) = REQUIRED,
  76. (google.api.resource_reference) = {
  77. type: "aiplatform.googleapis.com/EntityType"
  78. }
  79. ];
  80. // Required. The entities to be written. Up to 100,000 feature values can be written
  81. // across all `payloads`.
  82. repeated WriteFeatureValuesPayload payloads = 2 [(google.api.field_behavior) = REQUIRED];
  83. }
  84. // Contains Feature values to be written for a specific entity.
  85. message WriteFeatureValuesPayload {
  86. // Required. The ID of the entity.
  87. string entity_id = 1 [(google.api.field_behavior) = REQUIRED];
  88. // Required. Feature values to be written, mapping from Feature ID to value. Up to
  89. // 100,000 `feature_values` entries may be written across all payloads. The
  90. // feature generation time, aligned by days, must be no older than five
  91. // years (1825 days) and no later than one year (366 days) in the future.
  92. map<string, FeatureValue> feature_values = 2 [(google.api.field_behavior) = REQUIRED];
  93. }
  94. // Response message for [FeaturestoreOnlineServingService.WriteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService.WriteFeatureValues].
  95. message WriteFeatureValuesResponse {
  96. }
  97. // Request message for [FeaturestoreOnlineServingService.ReadFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService.ReadFeatureValues].
  98. message ReadFeatureValuesRequest {
  99. // Required. The resource name of the EntityType for the entity being read.
  100. // Value format:
  101. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  102. // For example, for a machine learning model predicting user clicks on a
  103. // website, an EntityType ID could be `user`.
  104. string entity_type = 1 [
  105. (google.api.field_behavior) = REQUIRED,
  106. (google.api.resource_reference) = {
  107. type: "aiplatform.googleapis.com/EntityType"
  108. }
  109. ];
  110. // Required. ID for a specific entity. For example,
  111. // for a machine learning model predicting user clicks on a website, an entity
  112. // ID could be `user_123`.
  113. string entity_id = 2 [(google.api.field_behavior) = REQUIRED];
  114. // Required. Selector choosing Features of the target EntityType.
  115. FeatureSelector feature_selector = 3 [(google.api.field_behavior) = REQUIRED];
  116. }
  117. // Response message for [FeaturestoreOnlineServingService.ReadFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService.ReadFeatureValues].
  118. message ReadFeatureValuesResponse {
  119. // Metadata for requested Features.
  120. message FeatureDescriptor {
  121. // Feature ID.
  122. string id = 1;
  123. }
  124. // Response header with metadata for the requested
  125. // [ReadFeatureValuesRequest.entity_type][google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest.entity_type] and Features.
  126. message Header {
  127. // The resource name of the EntityType from the
  128. // [ReadFeatureValuesRequest][google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest]. Value format:
  129. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  130. string entity_type = 1 [(google.api.resource_reference) = {
  131. type: "aiplatform.googleapis.com/EntityType"
  132. }];
  133. // List of Feature metadata corresponding to each piece of
  134. // [ReadFeatureValuesResponse.data][].
  135. repeated FeatureDescriptor feature_descriptors = 2;
  136. }
  137. // Entity view with Feature values.
  138. message EntityView {
  139. // Container to hold value(s), successive in time, for one Feature from the
  140. // request.
  141. message Data {
  142. oneof data {
  143. // Feature value if a single value is requested.
  144. FeatureValue value = 1;
  145. // Feature values list if values, successive in time, are requested.
  146. // If the requested number of values is greater than the number of
  147. // existing Feature values, nonexistent values are omitted instead of
  148. // being returned as empty.
  149. FeatureValueList values = 2;
  150. }
  151. }
  152. // ID of the requested entity.
  153. string entity_id = 1;
  154. // Each piece of data holds the k
  155. // requested values for one requested Feature. If no values
  156. // for the requested Feature exist, the corresponding cell will be empty.
  157. // This has the same size and is in the same order as the features from the
  158. // header [ReadFeatureValuesResponse.header][google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse.header].
  159. repeated Data data = 2;
  160. }
  161. // Response header.
  162. Header header = 1;
  163. // Entity view with Feature values. This may be the entity in the
  164. // Featurestore if values for all Features were requested, or a projection
  165. // of the entity in the Featurestore if values for only some Features were
  166. // requested.
  167. EntityView entity_view = 2;
  168. }
  169. // Request message for
  170. // [FeaturestoreOnlineServingService.StreamingFeatureValuesRead][].
  171. message StreamingReadFeatureValuesRequest {
  172. // Required. The resource name of the entities' type.
  173. // Value format:
  174. // `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
  175. // For example,
  176. // for a machine learning model predicting user clicks on a website, an
  177. // EntityType ID could be `user`.
  178. string entity_type = 1 [
  179. (google.api.field_behavior) = REQUIRED,
  180. (google.api.resource_reference) = {
  181. type: "aiplatform.googleapis.com/EntityType"
  182. }
  183. ];
  184. // Required. IDs of entities to read Feature values of. The maximum number of IDs is
  185. // 100. For example, for a machine learning model predicting user clicks on a
  186. // website, an entity ID could be `user_123`.
  187. repeated string entity_ids = 2 [(google.api.field_behavior) = REQUIRED];
  188. // Required. Selector choosing Features of the target EntityType. Feature IDs will be
  189. // deduplicated.
  190. FeatureSelector feature_selector = 3 [(google.api.field_behavior) = REQUIRED];
  191. }
  192. // Value for a feature.
  193. message FeatureValue {
  194. // Metadata of feature value.
  195. message Metadata {
  196. // Feature generation timestamp. Typically, it is provided by user at
  197. // feature ingestion time. If not, feature store
  198. // will use the system timestamp when the data is ingested into feature
  199. // store. For streaming ingestion, the time, aligned by days, must be no
  200. // older than five years (1825 days) and no later than one year (366 days)
  201. // in the future.
  202. google.protobuf.Timestamp generate_time = 1;
  203. }
  204. // Value for the feature.
  205. oneof value {
  206. // Bool type feature value.
  207. bool bool_value = 1;
  208. // Double type feature value.
  209. double double_value = 2;
  210. // Int64 feature value.
  211. int64 int64_value = 5;
  212. // String feature value.
  213. string string_value = 6;
  214. // A list of bool type feature value.
  215. BoolArray bool_array_value = 7;
  216. // A list of double type feature value.
  217. DoubleArray double_array_value = 8;
  218. // A list of int64 type feature value.
  219. Int64Array int64_array_value = 11;
  220. // A list of string type feature value.
  221. StringArray string_array_value = 12;
  222. // Bytes feature value.
  223. bytes bytes_value = 13;
  224. }
  225. // Metadata of feature value.
  226. Metadata metadata = 14;
  227. }
  228. // Container for list of values.
  229. message FeatureValueList {
  230. // A list of feature values. All of them should be the same data type.
  231. repeated FeatureValue values = 1;
  232. }