diff --git a/google/cloud/aiplatform/v1/aiplatform_v1.yaml b/google/cloud/aiplatform/v1/aiplatform_v1.yaml index 520de14b55..46d0d9549d 100644 --- a/google/cloud/aiplatform/v1/aiplatform_v1.yaml +++ b/google/cloud/aiplatform/v1/aiplatform_v1.yaml @@ -79,6 +79,8 @@ types: - name: google.cloud.aiplatform.v1.DeployIndexResponse - name: google.cloud.aiplatform.v1.DeployModelOperationMetadata - name: google.cloud.aiplatform.v1.DeployModelResponse +- name: google.cloud.aiplatform.v1.DeployOperationMetadata +- name: google.cloud.aiplatform.v1.DeployResponse - name: google.cloud.aiplatform.v1.ExportDataOperationMetadata - name: google.cloud.aiplatform.v1.ExportDataResponse - name: google.cloud.aiplatform.v1.ExportFeatureValuesOperationMetadata @@ -830,6 +832,10 @@ authentication: oauth: canonical_scopes: |- https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.aiplatform.v1.ModelGardenService.Deploy + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform - selector: google.cloud.aiplatform.v1.ModelGardenService.GetPublisherModel oauth: canonical_scopes: |- diff --git a/google/cloud/aiplatform/v1/model_garden_service.proto b/google/cloud/aiplatform/v1/model_garden_service.proto index daadb6e728..b2307fde88 100644 --- a/google/cloud/aiplatform/v1/model_garden_service.proto +++ b/google/cloud/aiplatform/v1/model_garden_service.proto @@ -20,7 +20,11 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/aiplatform/v1/machine_resources.proto"; +import "google/cloud/aiplatform/v1/model.proto"; +import "google/cloud/aiplatform/v1/operation.proto"; import "google/cloud/aiplatform/v1/publisher_model.proto"; +import "google/longrunning/operations.proto"; option csharp_namespace = "Google.Cloud.AIPlatform.V1"; option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb"; @@ -43,6 +47,18 @@ service ModelGardenService { }; option (google.api.method_signature) = "name"; } + + // Deploys a model to a new endpoint. + rpc Deploy(DeployRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{destination=projects/*/locations/*}:deploy" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "DeployResponse" + metadata_type: "DeployOperationMetadata" + }; + } } // View enumeration of PublisherModel. @@ -88,3 +104,166 @@ message GetPublisherModelRequest { // Optional. Token used to access Hugging Face gated models. string hugging_face_token = 6 [(google.api.field_behavior) = OPTIONAL]; } + +// Request message for +// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy]. +message DeployRequest { + // The model config to use for the deployment. + message ModelConfig { + // Optional. Whether the user accepts the End User License Agreement (EULA) + // for the model. + bool accept_eula = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Hugging Face read access token used to access the model + // artifacts of gated models. + string hugging_face_access_token = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the model will deploy with a cached version instead of + // directly downloading the model artifacts from Hugging Face. This is + // suitable for VPC-SC users with limited internet access. + bool hugging_face_cache_enabled = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The user-specified display name of the uploaded model. If not + // set, a default name will be used. + string model_display_name = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The specification of the container that is to be used when + // deploying. If not set, the default container spec will be used. + ModelContainerSpec container_spec = 5 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The endpoint config to use for the deployment. + message EndpointConfig { + // Optional. The user-specified display name of the endpoint. If not set, a + // default name will be used. + string endpoint_display_name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the endpoint will be exposed through a dedicated + // DNS [Endpoint.dedicated_endpoint_dns]. Your request to the dedicated DNS + // will be isolated from other users' traffic and will have better + // performance and reliability. Note: Once you enabled dedicated endpoint, + // you won't be able to send request to the shared DNS + // {region}-aiplatform.googleapis.com. The limitations will be removed soon. + bool dedicated_endpoint_enabled = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The deploy config to use for the deployment. + message DeployConfig { + // Optional. The dedicated resources to use for the endpoint. If not set, + // the default resources will be used. + DedicatedResources dedicated_resources = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, enable the QMT fast tryout feature for this model if + // possible. + bool fast_tryout_enabled = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. System labels for Model Garden deployments. + // These labels are managed by Google and for tracking purposes only. + map system_labels = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The artifacts to deploy. + oneof artifacts { + // The Model Garden model to deploy. + // Format: + // `publishers/{publisher}/models/{publisher_model}@{version_id}`, or + // `publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}@001`. + string publisher_model_name = 1 [(google.api.resource_reference) = { + type: "aiplatform.googleapis.com/PublisherModel" + }]; + + // The Hugging Face model to deploy. + // Format: Hugging Face model ID like `google/gemma-2-2b-it`. + string hugging_face_model_id = 2; + } + + // Required. The resource name of the Location to deploy the model in. + // Format: `projects/{project}/locations/{location}` + string destination = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The model config to use for the deployment. + // If not specified, the default model config will be used. + ModelConfig model_config = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The endpoint config to use for the deployment. + // If not specified, the default endpoint config will be used. + EndpointConfig endpoint_config = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The deploy config to use for the deployment. + // If not specified, the default deploy config will be used. + DeployConfig deploy_config = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy]. +message DeployResponse { + // Output only. The name of the PublisherModel resource. + // Format: + // `publishers/{publisher}/models/{publisher_model}@{version_id}`, or + // `publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}@001` + string publisher_model = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/PublisherModel" + } + ]; + + // Output only. The name of the Endpoint created. + // Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Output only. The name of the Model created. + // Format: `projects/{project}/locations/{location}/models/{model}` + string model = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Model" + } + ]; +} + +// Runtime operation information for +// [ModelGardenService.Deploy][google.cloud.aiplatform.v1.ModelGardenService.Deploy]. +message DeployOperationMetadata { + // The operation generic information. + GenericOperationMetadata generic_metadata = 1; + + // Output only. The name of the model resource. + string publisher_model = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/PublisherModel" + } + ]; + + // Output only. The resource name of the Location to deploy the model in. + // Format: `projects/{project}/locations/{location}` + string destination = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Output only. The project number where the deploy model request is sent. + int64 project_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The model id to be used at query time. + string model_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +}