xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1/genai_tuning_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2024 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/tuning_job.proto";
24import "google/protobuf/empty.proto";
25
26option csharp_namespace = "Google.Cloud.AIPlatform.V1";
27option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
28option java_multiple_files = true;
29option java_outer_classname = "GenAiTuningServiceProto";
30option java_package = "com.google.cloud.aiplatform.v1";
31option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
32option ruby_package = "Google::Cloud::AIPlatform::V1";
33
34// A service for creating and managing GenAI Tuning Jobs.
35service GenAiTuningService {
36  option (google.api.default_host) = "aiplatform.googleapis.com";
37  option (google.api.oauth_scopes) =
38      "https://www.googleapis.com/auth/cloud-platform";
39
40  // Creates a TuningJob. A created TuningJob right away will be attempted to
41  // be run.
42  rpc CreateTuningJob(CreateTuningJobRequest) returns (TuningJob) {
43    option (google.api.http) = {
44      post: "/v1/{parent=projects/*/locations/*}/tuningJobs"
45      body: "tuning_job"
46    };
47    option (google.api.method_signature) = "parent,tuning_job";
48  }
49
50  // Gets a TuningJob.
51  rpc GetTuningJob(GetTuningJobRequest) returns (TuningJob) {
52    option (google.api.http) = {
53      get: "/v1/{name=projects/*/locations/*/tuningJobs/*}"
54    };
55    option (google.api.method_signature) = "name";
56  }
57
58  // Lists TuningJobs in a Location.
59  rpc ListTuningJobs(ListTuningJobsRequest) returns (ListTuningJobsResponse) {
60    option (google.api.http) = {
61      get: "/v1/{parent=projects/*/locations/*}/tuningJobs"
62    };
63    option (google.api.method_signature) = "parent";
64  }
65
66  // Cancels a TuningJob.
67  // Starts asynchronous cancellation on the TuningJob. The server makes a best
68  // effort to cancel the job, but success is not guaranteed. Clients can use
69  // [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob]
70  // or other methods to check whether the cancellation succeeded or whether the
71  // job completed despite cancellation. On successful cancellation, the
72  // TuningJob is not deleted; instead it becomes a job with a
73  // [TuningJob.error][google.cloud.aiplatform.v1.TuningJob.error] value with a
74  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
75  // `Code.CANCELLED`, and
76  // [TuningJob.state][google.cloud.aiplatform.v1.TuningJob.state] is set to
77  // `CANCELLED`.
78  rpc CancelTuningJob(CancelTuningJobRequest) returns (google.protobuf.Empty) {
79    option (google.api.http) = {
80      post: "/v1/{name=projects/*/locations/*/tuningJobs/*}:cancel"
81      body: "*"
82    };
83    option (google.api.method_signature) = "name";
84  }
85}
86
87// Request message for
88// [GenAiTuningService.CreateTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.CreateTuningJob].
89message CreateTuningJobRequest {
90  // Required. The resource name of the Location to create the TuningJob in.
91  // Format: `projects/{project}/locations/{location}`
92  string parent = 1 [
93    (google.api.field_behavior) = REQUIRED,
94    (google.api.resource_reference) = {
95      type: "locations.googleapis.com/Location"
96    }
97  ];
98
99  // Required. The TuningJob to create.
100  TuningJob tuning_job = 2 [(google.api.field_behavior) = REQUIRED];
101}
102
103// Request message for
104// [GenAiTuningService.GetTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.GetTuningJob].
105message GetTuningJobRequest {
106  // Required. The name of the TuningJob resource. Format:
107  // `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`
108  string name = 1 [
109    (google.api.field_behavior) = REQUIRED,
110    (google.api.resource_reference) = {
111      type: "aiplatform.googleapis.com/TuningJob"
112    }
113  ];
114}
115
116// Request message for
117// [GenAiTuningService.ListTuningJobs][google.cloud.aiplatform.v1.GenAiTuningService.ListTuningJobs].
118message ListTuningJobsRequest {
119  // Required. The resource name of the Location to list the TuningJobs from.
120  // Format: `projects/{project}/locations/{location}`
121  string parent = 1 [
122    (google.api.field_behavior) = REQUIRED,
123    (google.api.resource_reference) = {
124      type: "locations.googleapis.com/Location"
125    }
126  ];
127
128  // Optional. The standard list filter.
129  string filter = 2 [(google.api.field_behavior) = OPTIONAL];
130
131  // Optional. The standard list page size.
132  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
133
134  // Optional. The standard list page token.
135  // Typically obtained via [ListTuningJob.next_page_token][] of the
136  // previous GenAiTuningService.ListTuningJob][] call.
137  string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
138}
139
140// Response message for
141// [GenAiTuningService.ListTuningJobs][google.cloud.aiplatform.v1.GenAiTuningService.ListTuningJobs]
142message ListTuningJobsResponse {
143  // List of TuningJobs in the requested page.
144  repeated TuningJob tuning_jobs = 1;
145
146  // A token to retrieve the next page of results.
147  // Pass to
148  // [ListTuningJobsRequest.page_token][google.cloud.aiplatform.v1.ListTuningJobsRequest.page_token]
149  // to obtain that page.
150  string next_page_token = 2;
151}
152
153// Request message for
154// [GenAiTuningService.CancelTuningJob][google.cloud.aiplatform.v1.GenAiTuningService.CancelTuningJob].
155message CancelTuningJobRequest {
156  // Required. The name of the TuningJob to cancel. Format:
157  // `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`
158  string name = 1 [
159    (google.api.field_behavior) = REQUIRED,
160    (google.api.resource_reference) = {
161      type: "aiplatform.googleapis.com/TuningJob"
162    }
163  ];
164}
165