xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1/vizier_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/operation.proto";
24import "google/cloud/aiplatform/v1/study.proto";
25import "google/longrunning/operations.proto";
26import "google/protobuf/empty.proto";
27import "google/protobuf/timestamp.proto";
28
29option csharp_namespace = "Google.Cloud.AIPlatform.V1";
30option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
31option java_multiple_files = true;
32option java_outer_classname = "VizierServiceProto";
33option java_package = "com.google.cloud.aiplatform.v1";
34option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
35option ruby_package = "Google::Cloud::AIPlatform::V1";
36
37// Vertex AI Vizier API.
38//
39// Vertex AI Vizier is a service to solve blackbox optimization problems,
40// such as tuning machine learning hyperparameters and searching over deep
41// learning architectures.
42service VizierService {
43  option (google.api.default_host) = "aiplatform.googleapis.com";
44  option (google.api.oauth_scopes) =
45      "https://www.googleapis.com/auth/cloud-platform";
46
47  // Creates a Study. A resource name will be generated after creation of the
48  // Study.
49  rpc CreateStudy(CreateStudyRequest) returns (Study) {
50    option (google.api.http) = {
51      post: "/v1/{parent=projects/*/locations/*}/studies"
52      body: "study"
53    };
54    option (google.api.method_signature) = "parent,study";
55  }
56
57  // Gets a Study by name.
58  rpc GetStudy(GetStudyRequest) returns (Study) {
59    option (google.api.http) = {
60      get: "/v1/{name=projects/*/locations/*/studies/*}"
61    };
62    option (google.api.method_signature) = "name";
63  }
64
65  // Lists all the studies in a region for an associated project.
66  rpc ListStudies(ListStudiesRequest) returns (ListStudiesResponse) {
67    option (google.api.http) = {
68      get: "/v1/{parent=projects/*/locations/*}/studies"
69    };
70    option (google.api.method_signature) = "parent";
71  }
72
73  // Deletes a Study.
74  rpc DeleteStudy(DeleteStudyRequest) returns (google.protobuf.Empty) {
75    option (google.api.http) = {
76      delete: "/v1/{name=projects/*/locations/*/studies/*}"
77    };
78    option (google.api.method_signature) = "name";
79  }
80
81  // Looks a study up using the user-defined display_name field instead of the
82  // fully qualified resource name.
83  rpc LookupStudy(LookupStudyRequest) returns (Study) {
84    option (google.api.http) = {
85      post: "/v1/{parent=projects/*/locations/*}/studies:lookup"
86      body: "*"
87    };
88    option (google.api.method_signature) = "parent";
89  }
90
91  // Adds one or more Trials to a Study, with parameter values
92  // suggested by Vertex AI Vizier. Returns a long-running
93  // operation associated with the generation of Trial suggestions.
94  // When this long-running operation succeeds, it will contain
95  // a
96  // [SuggestTrialsResponse][google.cloud.aiplatform.v1.SuggestTrialsResponse].
97  rpc SuggestTrials(SuggestTrialsRequest)
98      returns (google.longrunning.Operation) {
99    option (google.api.http) = {
100      post: "/v1/{parent=projects/*/locations/*/studies/*}/trials:suggest"
101      body: "*"
102    };
103    option (google.longrunning.operation_info) = {
104      response_type: "SuggestTrialsResponse"
105      metadata_type: "SuggestTrialsMetadata"
106    };
107  }
108
109  // Adds a user provided Trial to a Study.
110  rpc CreateTrial(CreateTrialRequest) returns (Trial) {
111    option (google.api.http) = {
112      post: "/v1/{parent=projects/*/locations/*/studies/*}/trials"
113      body: "trial"
114    };
115    option (google.api.method_signature) = "parent,trial";
116  }
117
118  // Gets a Trial.
119  rpc GetTrial(GetTrialRequest) returns (Trial) {
120    option (google.api.http) = {
121      get: "/v1/{name=projects/*/locations/*/studies/*/trials/*}"
122    };
123    option (google.api.method_signature) = "name";
124  }
125
126  // Lists the Trials associated with a Study.
127  rpc ListTrials(ListTrialsRequest) returns (ListTrialsResponse) {
128    option (google.api.http) = {
129      get: "/v1/{parent=projects/*/locations/*/studies/*}/trials"
130    };
131    option (google.api.method_signature) = "parent";
132  }
133
134  // Adds a measurement of the objective metrics to a Trial. This measurement
135  // is assumed to have been taken before the Trial is complete.
136  rpc AddTrialMeasurement(AddTrialMeasurementRequest) returns (Trial) {
137    option (google.api.http) = {
138      post: "/v1/{trial_name=projects/*/locations/*/studies/*/trials/*}:addTrialMeasurement"
139      body: "*"
140    };
141  }
142
143  // Marks a Trial as complete.
144  rpc CompleteTrial(CompleteTrialRequest) returns (Trial) {
145    option (google.api.http) = {
146      post: "/v1/{name=projects/*/locations/*/studies/*/trials/*}:complete"
147      body: "*"
148    };
149  }
150
151  // Deletes a Trial.
152  rpc DeleteTrial(DeleteTrialRequest) returns (google.protobuf.Empty) {
153    option (google.api.http) = {
154      delete: "/v1/{name=projects/*/locations/*/studies/*/trials/*}"
155    };
156    option (google.api.method_signature) = "name";
157  }
158
159  // Checks  whether a Trial should stop or not. Returns a
160  // long-running operation. When the operation is successful,
161  // it will contain a
162  // [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1.CheckTrialEarlyStoppingStateResponse].
163  rpc CheckTrialEarlyStoppingState(CheckTrialEarlyStoppingStateRequest)
164      returns (google.longrunning.Operation) {
165    option (google.api.http) = {
166      post: "/v1/{trial_name=projects/*/locations/*/studies/*/trials/*}:checkTrialEarlyStoppingState"
167      body: "*"
168    };
169    option (google.longrunning.operation_info) = {
170      response_type: "CheckTrialEarlyStoppingStateResponse"
171      metadata_type: "CheckTrialEarlyStoppingStateMetatdata"
172    };
173  }
174
175  // Stops a Trial.
176  rpc StopTrial(StopTrialRequest) returns (Trial) {
177    option (google.api.http) = {
178      post: "/v1/{name=projects/*/locations/*/studies/*/trials/*}:stop"
179      body: "*"
180    };
181  }
182
183  // Lists the pareto-optimal Trials for multi-objective Study or the
184  // optimal Trials for single-objective Study. The definition of
185  // pareto-optimal can be checked in wiki page.
186  // https://en.wikipedia.org/wiki/Pareto_efficiency
187  rpc ListOptimalTrials(ListOptimalTrialsRequest)
188      returns (ListOptimalTrialsResponse) {
189    option (google.api.http) = {
190      post: "/v1/{parent=projects/*/locations/*/studies/*}/trials:listOptimalTrials"
191      body: "*"
192    };
193    option (google.api.method_signature) = "parent";
194  }
195}
196
197// Request message for
198// [VizierService.GetStudy][google.cloud.aiplatform.v1.VizierService.GetStudy].
199message GetStudyRequest {
200  // Required. The name of the Study resource.
201  // Format: `projects/{project}/locations/{location}/studies/{study}`
202  string name = 1 [
203    (google.api.field_behavior) = REQUIRED,
204    (google.api.resource_reference) = {
205      type: "aiplatform.googleapis.com/Study"
206    }
207  ];
208}
209
210// Request message for
211// [VizierService.CreateStudy][google.cloud.aiplatform.v1.VizierService.CreateStudy].
212message CreateStudyRequest {
213  // Required. The resource name of the Location to create the CustomJob in.
214  // Format: `projects/{project}/locations/{location}`
215  string parent = 1 [
216    (google.api.field_behavior) = REQUIRED,
217    (google.api.resource_reference) = {
218      type: "locations.googleapis.com/Location"
219    }
220  ];
221
222  // Required. The Study configuration used to create the Study.
223  Study study = 2 [(google.api.field_behavior) = REQUIRED];
224}
225
226// Request message for
227// [VizierService.ListStudies][google.cloud.aiplatform.v1.VizierService.ListStudies].
228message ListStudiesRequest {
229  // Required. The resource name of the Location to list the Study from.
230  // Format: `projects/{project}/locations/{location}`
231  string parent = 1 [
232    (google.api.field_behavior) = REQUIRED,
233    (google.api.resource_reference) = {
234      type: "locations.googleapis.com/Location"
235    }
236  ];
237
238  // Optional. A page token to request the next page of results.
239  // If unspecified, there are no subsequent pages.
240  string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
241
242  // Optional. The maximum number of studies to return per "page" of results.
243  // If unspecified, service will pick an appropriate default.
244  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
245}
246
247// Response message for
248// [VizierService.ListStudies][google.cloud.aiplatform.v1.VizierService.ListStudies].
249message ListStudiesResponse {
250  // The studies associated with the project.
251  repeated Study studies = 1;
252
253  // Passes this token as the `page_token` field of the request for a
254  // subsequent call.
255  // If this field is omitted, there are no subsequent pages.
256  string next_page_token = 2;
257}
258
259// Request message for
260// [VizierService.DeleteStudy][google.cloud.aiplatform.v1.VizierService.DeleteStudy].
261message DeleteStudyRequest {
262  // Required. The name of the Study resource to be deleted.
263  // Format: `projects/{project}/locations/{location}/studies/{study}`
264  string name = 1 [
265    (google.api.field_behavior) = REQUIRED,
266    (google.api.resource_reference) = {
267      type: "aiplatform.googleapis.com/Study"
268    }
269  ];
270}
271
272// Request message for
273// [VizierService.LookupStudy][google.cloud.aiplatform.v1.VizierService.LookupStudy].
274message LookupStudyRequest {
275  // Required. The resource name of the Location to get the Study from.
276  // Format: `projects/{project}/locations/{location}`
277  string parent = 1 [
278    (google.api.field_behavior) = REQUIRED,
279    (google.api.resource_reference) = {
280      type: "locations.googleapis.com/Location"
281    }
282  ];
283
284  // Required. The user-defined display name of the Study
285  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
286}
287
288// Request message for
289// [VizierService.SuggestTrials][google.cloud.aiplatform.v1.VizierService.SuggestTrials].
290message SuggestTrialsRequest {
291  // Required. The project and location that the Study belongs to.
292  // Format: `projects/{project}/locations/{location}/studies/{study}`
293  string parent = 1 [
294    (google.api.field_behavior) = REQUIRED,
295    (google.api.resource_reference) = {
296      type: "aiplatform.googleapis.com/Study"
297    }
298  ];
299
300  // Required. The number of suggestions requested. It must be positive.
301  int32 suggestion_count = 2 [(google.api.field_behavior) = REQUIRED];
302
303  // Required. The identifier of the client that is requesting the suggestion.
304  //
305  // If multiple SuggestTrialsRequests have the same `client_id`,
306  // the service will return the identical suggested Trial if the Trial is
307  // pending, and provide a new Trial if the last suggested Trial was completed.
308  string client_id = 3 [(google.api.field_behavior) = REQUIRED];
309
310  // Optional. This allows you to specify the "context" for a Trial; a context
311  // is a slice (a subspace) of the search space.
312  //
313  // Typical uses for contexts:
314  // 1) You are using Vizier to tune a server for best performance, but there's
315  //   a strong weekly cycle.  The context specifies the day-of-week.
316  //   This allows Tuesday to generalize from Wednesday without assuming that
317  //   everything is identical.
318  // 2) Imagine you're optimizing some medical treatment for people.
319  //   As they walk in the door, you know certain facts about them
320  //   (e.g. sex, weight, height, blood-pressure).  Put that information in the
321  //   context, and Vizier will adapt its suggestions to the patient.
322  // 3) You want to do a fair A/B test efficiently.  Specify the "A" and "B"
323  //   conditions as contexts, and Vizier will generalize between "A" and "B"
324  //   conditions.  If they are similar, this will allow Vizier to converge
325  //   to the optimum faster than if "A" and "B" were separate Studies.
326  //   NOTE: You can also enter contexts as REQUESTED Trials, e.g. via the
327  //   CreateTrial() RPC; that's the asynchronous option where you don't need a
328  //   close association between contexts and suggestions.
329  //
330  // NOTE: All the Parameters you set in a context MUST be defined in the
331  //   Study.
332  // NOTE: You must supply 0 or $suggestion_count contexts.
333  //   If you don't supply any contexts, Vizier will make suggestions
334  //   from the full search space specified in the StudySpec; if you supply
335  //   a full set of context, each suggestion will match the corresponding
336  //   context.
337  // NOTE: A Context with no features set matches anything, and allows
338  //   suggestions from the full search space.
339  // NOTE: Contexts MUST lie within the search space specified in the
340  //   StudySpec.  It's an error if they don't.
341  // NOTE: Contexts preferentially match ACTIVE then REQUESTED trials before
342  //   new suggestions are generated.
343  // NOTE: Generation of suggestions involves a match between a Context and
344  //   (optionally) a REQUESTED trial; if that match is not fully specified, a
345  //   suggestion will be geneated in the merged subspace.
346  repeated TrialContext contexts = 4 [(google.api.field_behavior) = OPTIONAL];
347}
348
349// Response message for
350// [VizierService.SuggestTrials][google.cloud.aiplatform.v1.VizierService.SuggestTrials].
351message SuggestTrialsResponse {
352  // A list of Trials.
353  repeated Trial trials = 1;
354
355  // The state of the Study.
356  Study.State study_state = 2;
357
358  // The time at which the operation was started.
359  google.protobuf.Timestamp start_time = 3;
360
361  // The time at which operation processing completed.
362  google.protobuf.Timestamp end_time = 4;
363}
364
365// Details of operations that perform Trials suggestion.
366message SuggestTrialsMetadata {
367  // Operation metadata for suggesting Trials.
368  GenericOperationMetadata generic_metadata = 1;
369
370  // The identifier of the client that is requesting the suggestion.
371  //
372  // If multiple SuggestTrialsRequests have the same `client_id`,
373  // the service will return the identical suggested Trial if the Trial is
374  // pending, and provide a new Trial if the last suggested Trial was completed.
375  string client_id = 2;
376}
377
378// Request message for
379// [VizierService.CreateTrial][google.cloud.aiplatform.v1.VizierService.CreateTrial].
380message CreateTrialRequest {
381  // Required. The resource name of the Study to create the Trial in.
382  // Format: `projects/{project}/locations/{location}/studies/{study}`
383  string parent = 1 [
384    (google.api.field_behavior) = REQUIRED,
385    (google.api.resource_reference) = {
386      type: "aiplatform.googleapis.com/Study"
387    }
388  ];
389
390  // Required. The Trial to create.
391  Trial trial = 2 [(google.api.field_behavior) = REQUIRED];
392}
393
394// Request message for
395// [VizierService.GetTrial][google.cloud.aiplatform.v1.VizierService.GetTrial].
396message GetTrialRequest {
397  // Required. The name of the Trial resource.
398  // Format:
399  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
400  string name = 1 [
401    (google.api.field_behavior) = REQUIRED,
402    (google.api.resource_reference) = {
403      type: "aiplatform.googleapis.com/Trial"
404    }
405  ];
406}
407
408// Request message for
409// [VizierService.ListTrials][google.cloud.aiplatform.v1.VizierService.ListTrials].
410message ListTrialsRequest {
411  // Required. The resource name of the Study to list the Trial from.
412  // Format: `projects/{project}/locations/{location}/studies/{study}`
413  string parent = 1 [
414    (google.api.field_behavior) = REQUIRED,
415    (google.api.resource_reference) = {
416      type: "aiplatform.googleapis.com/Study"
417    }
418  ];
419
420  // Optional. A page token to request the next page of results.
421  // If unspecified, there are no subsequent pages.
422  string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
423
424  // Optional. The number of Trials to retrieve per "page" of results.
425  // If unspecified, the service will pick an appropriate default.
426  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
427}
428
429// Response message for
430// [VizierService.ListTrials][google.cloud.aiplatform.v1.VizierService.ListTrials].
431message ListTrialsResponse {
432  // The Trials associated with the Study.
433  repeated Trial trials = 1;
434
435  // Pass this token as the `page_token` field of the request for a
436  // subsequent call.
437  // If this field is omitted, there are no subsequent pages.
438  string next_page_token = 2;
439}
440
441// Request message for
442// [VizierService.AddTrialMeasurement][google.cloud.aiplatform.v1.VizierService.AddTrialMeasurement].
443message AddTrialMeasurementRequest {
444  // Required. The name of the trial to add measurement.
445  // Format:
446  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
447  string trial_name = 1 [
448    (google.api.field_behavior) = REQUIRED,
449    (google.api.resource_reference) = {
450      type: "aiplatform.googleapis.com/Trial"
451    }
452  ];
453
454  // Required. The measurement to be added to a Trial.
455  Measurement measurement = 3 [(google.api.field_behavior) = REQUIRED];
456}
457
458// Request message for
459// [VizierService.CompleteTrial][google.cloud.aiplatform.v1.VizierService.CompleteTrial].
460message CompleteTrialRequest {
461  // Required. The Trial's name.
462  // Format:
463  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
464  string name = 1 [
465    (google.api.field_behavior) = REQUIRED,
466    (google.api.resource_reference) = {
467      type: "aiplatform.googleapis.com/Trial"
468    }
469  ];
470
471  // Optional. If provided, it will be used as the completed Trial's
472  // final_measurement; Otherwise, the service will auto-select a
473  // previously reported measurement as the final-measurement
474  Measurement final_measurement = 2 [(google.api.field_behavior) = OPTIONAL];
475
476  // Optional. True if the Trial cannot be run with the given Parameter, and
477  // final_measurement will be ignored.
478  bool trial_infeasible = 3 [(google.api.field_behavior) = OPTIONAL];
479
480  // Optional. A human readable reason why the trial was infeasible. This should
481  // only be provided if `trial_infeasible` is true.
482  string infeasible_reason = 4 [(google.api.field_behavior) = OPTIONAL];
483}
484
485// Request message for
486// [VizierService.DeleteTrial][google.cloud.aiplatform.v1.VizierService.DeleteTrial].
487message DeleteTrialRequest {
488  // Required. The Trial's name.
489  // Format:
490  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
491  string name = 1 [
492    (google.api.field_behavior) = REQUIRED,
493    (google.api.resource_reference) = {
494      type: "aiplatform.googleapis.com/Trial"
495    }
496  ];
497}
498
499// Request message for
500// [VizierService.CheckTrialEarlyStoppingState][google.cloud.aiplatform.v1.VizierService.CheckTrialEarlyStoppingState].
501message CheckTrialEarlyStoppingStateRequest {
502  // Required. The Trial's name.
503  // Format:
504  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
505  string trial_name = 1 [
506    (google.api.field_behavior) = REQUIRED,
507    (google.api.resource_reference) = {
508      type: "aiplatform.googleapis.com/Trial"
509    }
510  ];
511}
512
513// Response message for
514// [VizierService.CheckTrialEarlyStoppingState][google.cloud.aiplatform.v1.VizierService.CheckTrialEarlyStoppingState].
515message CheckTrialEarlyStoppingStateResponse {
516  // True if the Trial should stop.
517  bool should_stop = 1;
518}
519
520// This message will be placed in the metadata field of a
521// google.longrunning.Operation associated with a CheckTrialEarlyStoppingState
522// request.
523message CheckTrialEarlyStoppingStateMetatdata {
524  // Operation metadata for suggesting Trials.
525  GenericOperationMetadata generic_metadata = 1;
526
527  // The name of the Study that the Trial belongs to.
528  string study = 2;
529
530  // The Trial name.
531  string trial = 3;
532}
533
534// Request message for
535// [VizierService.StopTrial][google.cloud.aiplatform.v1.VizierService.StopTrial].
536message StopTrialRequest {
537  // Required. The Trial's name.
538  // Format:
539  // `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`
540  string name = 1 [
541    (google.api.field_behavior) = REQUIRED,
542    (google.api.resource_reference) = {
543      type: "aiplatform.googleapis.com/Trial"
544    }
545  ];
546}
547
548// Request message for
549// [VizierService.ListOptimalTrials][google.cloud.aiplatform.v1.VizierService.ListOptimalTrials].
550message ListOptimalTrialsRequest {
551  // Required. The name of the Study that the optimal Trial belongs to.
552  string parent = 1 [
553    (google.api.field_behavior) = REQUIRED,
554    (google.api.resource_reference) = {
555      type: "aiplatform.googleapis.com/Study"
556    }
557  ];
558}
559
560// Response message for
561// [VizierService.ListOptimalTrials][google.cloud.aiplatform.v1.VizierService.ListOptimalTrials].
562message ListOptimalTrialsResponse {
563  // The pareto-optimal Trials for multiple objective Study or the
564  // optimal trial for single objective Study. The definition of
565  // pareto-optimal can be checked in wiki page.
566  // https://en.wikipedia.org/wiki/Pareto_efficiency
567  repeated Trial optimal_trials = 1;
568}
569