Skip to content

Commit ab2a125

Browse files
Google APIscopybara-github
authored andcommitted
feat: add Model Garden deploy OSS model API
PiperOrigin-RevId: 772620353
1 parent 2f31b66 commit ab2a125

2 files changed

Lines changed: 185 additions & 0 deletions

File tree

google/cloud/aiplatform/v1/aiplatform_v1.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ types:
7979
- name: google.cloud.aiplatform.v1.DeployIndexResponse
8080
- name: google.cloud.aiplatform.v1.DeployModelOperationMetadata
8181
- name: google.cloud.aiplatform.v1.DeployModelResponse
82+
- name: google.cloud.aiplatform.v1.DeployOperationMetadata
83+
- name: google.cloud.aiplatform.v1.DeployResponse
8284
- name: google.cloud.aiplatform.v1.ExportDataOperationMetadata
8385
- name: google.cloud.aiplatform.v1.ExportDataResponse
8486
- name: google.cloud.aiplatform.v1.ExportFeatureValuesOperationMetadata
@@ -830,6 +832,10 @@ authentication:
830832
oauth:
831833
canonical_scopes: |-
832834
https://www.googleapis.com/auth/cloud-platform
835+
- selector: google.cloud.aiplatform.v1.ModelGardenService.Deploy
836+
oauth:
837+
canonical_scopes: |-
838+
https://www.googleapis.com/auth/cloud-platform
833839
- selector: google.cloud.aiplatform.v1.ModelGardenService.GetPublisherModel
834840
oauth:
835841
canonical_scopes: |-

google/cloud/aiplatform/v1/model_garden_service.proto

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import "google/api/annotations.proto";
2020
import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
23+
import "google/cloud/aiplatform/v1/machine_resources.proto";
24+
import "google/cloud/aiplatform/v1/model.proto";
25+
import "google/cloud/aiplatform/v1/operation.proto";
2326
import "google/cloud/aiplatform/v1/publisher_model.proto";
27+
import "google/longrunning/operations.proto";
2428

2529
option csharp_namespace = "Google.Cloud.AIPlatform.V1";
2630
option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
@@ -43,6 +47,18 @@ service ModelGardenService {
4347
};
4448
option (google.api.method_signature) = "name";
4549
}
50+
51+
// Deploys a model to a new endpoint.
52+
rpc Deploy(DeployRequest) returns (google.longrunning.Operation) {
53+
option (google.api.http) = {
54+
post: "/v1/{destination=projects/*/locations/*}:deploy"
55+
body: "*"
56+
};
57+
option (google.longrunning.operation_info) = {
58+
response_type: "DeployResponse"
59+
metadata_type: "DeployOperationMetadata"
60+
};
61+
}
4662
}
4763

4864
// View enumeration of PublisherModel.
@@ -88,3 +104,166 @@ message GetPublisherModelRequest {
88104
// Optional. Token used to access Hugging Face gated models.
89105
string hugging_face_token = 6 [(google.api.field_behavior) = OPTIONAL];
90106
}
107+
108+
// Request message for
109+
// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy].
110+
message DeployRequest {
111+
// The model config to use for the deployment.
112+
message ModelConfig {
113+
// Optional. Whether the user accepts the End User License Agreement (EULA)
114+
// for the model.
115+
bool accept_eula = 1 [(google.api.field_behavior) = OPTIONAL];
116+
117+
// Optional. The Hugging Face read access token used to access the model
118+
// artifacts of gated models.
119+
string hugging_face_access_token = 2
120+
[(google.api.field_behavior) = OPTIONAL];
121+
122+
// Optional. If true, the model will deploy with a cached version instead of
123+
// directly downloading the model artifacts from Hugging Face. This is
124+
// suitable for VPC-SC users with limited internet access.
125+
bool hugging_face_cache_enabled = 3
126+
[(google.api.field_behavior) = OPTIONAL];
127+
128+
// Optional. The user-specified display name of the uploaded model. If not
129+
// set, a default name will be used.
130+
string model_display_name = 4 [(google.api.field_behavior) = OPTIONAL];
131+
132+
// Optional. The specification of the container that is to be used when
133+
// deploying. If not set, the default container spec will be used.
134+
ModelContainerSpec container_spec = 5
135+
[(google.api.field_behavior) = OPTIONAL];
136+
}
137+
138+
// The endpoint config to use for the deployment.
139+
message EndpointConfig {
140+
// Optional. The user-specified display name of the endpoint. If not set, a
141+
// default name will be used.
142+
string endpoint_display_name = 1 [(google.api.field_behavior) = OPTIONAL];
143+
144+
// Optional. If true, the endpoint will be exposed through a dedicated
145+
// DNS [Endpoint.dedicated_endpoint_dns]. Your request to the dedicated DNS
146+
// will be isolated from other users' traffic and will have better
147+
// performance and reliability. Note: Once you enabled dedicated endpoint,
148+
// you won't be able to send request to the shared DNS
149+
// {region}-aiplatform.googleapis.com. The limitations will be removed soon.
150+
bool dedicated_endpoint_enabled = 2
151+
[(google.api.field_behavior) = OPTIONAL];
152+
}
153+
154+
// The deploy config to use for the deployment.
155+
message DeployConfig {
156+
// Optional. The dedicated resources to use for the endpoint. If not set,
157+
// the default resources will be used.
158+
DedicatedResources dedicated_resources = 1
159+
[(google.api.field_behavior) = OPTIONAL];
160+
161+
// Optional. If true, enable the QMT fast tryout feature for this model if
162+
// possible.
163+
bool fast_tryout_enabled = 2 [(google.api.field_behavior) = OPTIONAL];
164+
165+
// Optional. System labels for Model Garden deployments.
166+
// These labels are managed by Google and for tracking purposes only.
167+
map<string, string> system_labels = 3
168+
[(google.api.field_behavior) = OPTIONAL];
169+
}
170+
171+
// The artifacts to deploy.
172+
oneof artifacts {
173+
// The Model Garden model to deploy.
174+
// Format:
175+
// `publishers/{publisher}/models/{publisher_model}@{version_id}`, or
176+
// `publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}@001`.
177+
string publisher_model_name = 1 [(google.api.resource_reference) = {
178+
type: "aiplatform.googleapis.com/PublisherModel"
179+
}];
180+
181+
// The Hugging Face model to deploy.
182+
// Format: Hugging Face model ID like `google/gemma-2-2b-it`.
183+
string hugging_face_model_id = 2;
184+
}
185+
186+
// Required. The resource name of the Location to deploy the model in.
187+
// Format: `projects/{project}/locations/{location}`
188+
string destination = 4 [
189+
(google.api.field_behavior) = REQUIRED,
190+
(google.api.resource_reference) = {
191+
type: "locations.googleapis.com/Location"
192+
}
193+
];
194+
195+
// Optional. The model config to use for the deployment.
196+
// If not specified, the default model config will be used.
197+
ModelConfig model_config = 5 [(google.api.field_behavior) = OPTIONAL];
198+
199+
// Optional. The endpoint config to use for the deployment.
200+
// If not specified, the default endpoint config will be used.
201+
EndpointConfig endpoint_config = 6 [(google.api.field_behavior) = OPTIONAL];
202+
203+
// Optional. The deploy config to use for the deployment.
204+
// If not specified, the default deploy config will be used.
205+
DeployConfig deploy_config = 7 [(google.api.field_behavior) = OPTIONAL];
206+
}
207+
208+
// Response message for
209+
// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy].
210+
message DeployResponse {
211+
// Output only. The name of the PublisherModel resource.
212+
// Format:
213+
// `publishers/{publisher}/models/{publisher_model}@{version_id}`, or
214+
// `publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}@001`
215+
string publisher_model = 1 [
216+
(google.api.field_behavior) = OUTPUT_ONLY,
217+
(google.api.resource_reference) = {
218+
type: "aiplatform.googleapis.com/PublisherModel"
219+
}
220+
];
221+
222+
// Output only. The name of the Endpoint created.
223+
// Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
224+
string endpoint = 2 [
225+
(google.api.field_behavior) = OUTPUT_ONLY,
226+
(google.api.resource_reference) = {
227+
type: "aiplatform.googleapis.com/Endpoint"
228+
}
229+
];
230+
231+
// Output only. The name of the Model created.
232+
// Format: `projects/{project}/locations/{location}/models/{model}`
233+
string model = 3 [
234+
(google.api.field_behavior) = OUTPUT_ONLY,
235+
(google.api.resource_reference) = {
236+
type: "aiplatform.googleapis.com/Model"
237+
}
238+
];
239+
}
240+
241+
// Runtime operation information for
242+
// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy].
243+
message DeployOperationMetadata {
244+
// The operation generic information.
245+
GenericOperationMetadata generic_metadata = 1;
246+
247+
// Output only. The name of the model resource.
248+
string publisher_model = 2 [
249+
(google.api.field_behavior) = OUTPUT_ONLY,
250+
(google.api.resource_reference) = {
251+
type: "aiplatform.googleapis.com/PublisherModel"
252+
}
253+
];
254+
255+
// Output only. The resource name of the Location to deploy the model in.
256+
// Format: `projects/{project}/locations/{location}`
257+
string destination = 3 [
258+
(google.api.field_behavior) = OUTPUT_ONLY,
259+
(google.api.resource_reference) = {
260+
type: "locations.googleapis.com/Location"
261+
}
262+
];
263+
264+
// Output only. The project number where the deploy model request is sent.
265+
int64 project_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
266+
267+
// Output only. The model id to be used at query time.
268+
string model_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
269+
}

0 commit comments

Comments
 (0)