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