Vertex AI V1 API - Class Google::Cloud::AIPlatform::V1::ModelService::Client (v0.19.0)

Reference documentation and code samples for the Vertex AI V1 API class Google::Cloud::AIPlatform::V1::ModelService::Client.

Client for the ModelService service.

A service for managing Vertex AI's machine learning Models.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the ModelService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ModelService clients
::Google::Cloud::AIPlatform::V1::ModelService::Client.configure do |config|
  config.timeout = 10.0
end

#batch_import_model_evaluation_slices

def batch_import_model_evaluation_slices(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesResponse
def batch_import_model_evaluation_slices(parent: nil, model_evaluation_slices: nil) -> ::Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesResponse

Imports a list of externally generated ModelEvaluationSlice.

Overloads
def batch_import_model_evaluation_slices(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesResponse
Pass arguments to batch_import_model_evaluation_slices via a request object, either of type BatchImportModelEvaluationSlicesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def batch_import_model_evaluation_slices(parent: nil, model_evaluation_slices: nil) -> ::Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesResponse
Pass arguments to batch_import_model_evaluation_slices via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the parent ModelEvaluation resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}
  • model_evaluation_slices (::Array<::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice, ::Hash>) — Required. Model evaluation slice resource to be imported.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesRequest.new

# Call the batch_import_model_evaluation_slices method.
result = client.batch_import_model_evaluation_slices request

# The returned object is of type Google::Cloud::AIPlatform::V1::BatchImportModelEvaluationSlicesResponse.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the ModelService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#copy_model

def copy_model(request, options = nil) -> ::Gapic::Operation
def copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil) -> ::Gapic::Operation

Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for Model.metadata content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.

Overloads
def copy_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to copy_model via a request object, either of type CopyModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::CopyModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil) -> ::Gapic::Operation
Pass arguments to copy_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • model_id (::String) — Optional. Copy source_model into a new Model with this ID. The ID will become the final component of the model resource name.

    This value may be up to 63 characters, and valid characters are [a-z0-9_-]. The first character cannot be a number or hyphen.

  • parent_model (::String) — Optional. Specify this field to copy source_model into this existing Model as a new version. Format: projects/{project}/locations/{location}/models/{model}
  • parent (::String) — Required. The resource name of the Location into which to copy the Model. Format: projects/{project}/locations/{location}
  • source_model (::String) — Required. The resource name of the Model to copy. That Model must be in the same Project. Format: projects/{project}/locations/{location}/models/{model}
  • encryption_spec (::Google::Cloud::AIPlatform::V1::EncryptionSpec, ::Hash) — Customer-managed encryption key options. If this is set, then the Model copy will be encrypted with the provided encryption key.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::CopyModelRequest.new

# Call the copy_model method.
result = client.copy_model request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#delete_model

def delete_model(request, options = nil) -> ::Gapic::Operation
def delete_model(name: nil) -> ::Gapic::Operation

Deletes a Model.

A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.

Overloads
def delete_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_model via a request object, either of type DeleteModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::DeleteModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_model(name: nil) -> ::Gapic::Operation
Pass arguments to delete_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the Model resource to be deleted. Format: projects/{project}/locations/{location}/models/{model}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::DeleteModelRequest.new

# Call the delete_model method.
result = client.delete_model request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#delete_model_version

def delete_model_version(request, options = nil) -> ::Gapic::Operation
def delete_model_version(name: nil) -> ::Gapic::Operation

Deletes a Model version.

Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.

Overloads
def delete_model_version(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_model_version via a request object, either of type DeleteModelVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::DeleteModelVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_model_version(name: nil) -> ::Gapic::Operation
Pass arguments to delete_model_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the model version to be deleted, with a version ID explicitly included.

    Example: projects/{project}/locations/{location}/models/{model}@1234

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::DeleteModelVersionRequest.new

# Call the delete_model_version method.
result = client.delete_model_version request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#export_model

def export_model(request, options = nil) -> ::Gapic::Operation
def export_model(name: nil, output_config: nil) -> ::Gapic::Operation

Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1.Model.supported_export_formats].

Overloads
def export_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to export_model via a request object, either of type ExportModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ExportModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def export_model(name: nil, output_config: nil) -> ::Gapic::Operation
Pass arguments to export_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the Model to export. The resource name may contain version id or version alias to specify the version, if no version is specified, the default version will be exported.
  • output_config (::Google::Cloud::AIPlatform::V1::ExportModelRequest::OutputConfig, ::Hash) — Required. The desired output location and configuration.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ExportModelRequest.new

# Call the export_model method.
result = client.export_model request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#get_model

def get_model(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
def get_model(name: nil) -> ::Google::Cloud::AIPlatform::V1::Model

Gets a Model.

Overloads
def get_model(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to get_model via a request object, either of type GetModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::GetModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_model(name: nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to get_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the Model resource. Format: projects/{project}/locations/{location}/models/{model}

    In order to retrieve a specific version of the model, also provide the version ID or version alias. Example: projects/{project}/locations/{location}/models/{model}@2 or projects/{project}/locations/{location}/models/{model}@golden If no version ID or alias is specified, the "default" version will be returned. The "default" version alias is created for the first version of the model, and can be moved to other versions later on. There will be exactly one default version.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::GetModelRequest.new

# Call the get_model method.
result = client.get_model request

# The returned object is of type Google::Cloud::AIPlatform::V1::Model.
p result

#get_model_evaluation

def get_model_evaluation(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
def get_model_evaluation(name: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation

Gets a ModelEvaluation.

Overloads
def get_model_evaluation(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
Pass arguments to get_model_evaluation via a request object, either of type GetModelEvaluationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::GetModelEvaluationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_model_evaluation(name: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
Pass arguments to get_model_evaluation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the ModelEvaluation resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::GetModelEvaluationRequest.new

# Call the get_model_evaluation method.
result = client.get_model_evaluation request

# The returned object is of type Google::Cloud::AIPlatform::V1::ModelEvaluation.
p result

#get_model_evaluation_slice

def get_model_evaluation_slice(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice
def get_model_evaluation_slice(name: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice

Gets a ModelEvaluationSlice.

Overloads
def get_model_evaluation_slice(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice
Pass arguments to get_model_evaluation_slice via a request object, either of type GetModelEvaluationSliceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::GetModelEvaluationSliceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_model_evaluation_slice(name: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice
Pass arguments to get_model_evaluation_slice via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the ModelEvaluationSlice resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::GetModelEvaluationSliceRequest.new

# Call the get_model_evaluation_slice method.
result = client.get_model_evaluation_slice request

# The returned object is of type Google::Cloud::AIPlatform::V1::ModelEvaluationSlice.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Client)

#import_model_evaluation

def import_model_evaluation(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
def import_model_evaluation(parent: nil, model_evaluation: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation

Imports an externally generated ModelEvaluation.

Overloads
def import_model_evaluation(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
Pass arguments to import_model_evaluation via a request object, either of type ImportModelEvaluationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ImportModelEvaluationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_model_evaluation(parent: nil, model_evaluation: nil) -> ::Google::Cloud::AIPlatform::V1::ModelEvaluation
Pass arguments to import_model_evaluation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the parent model resource. Format: projects/{project}/locations/{location}/models/{model}
  • model_evaluation (::Google::Cloud::AIPlatform::V1::ModelEvaluation, ::Hash) — Required. Model evaluation resource to be imported.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ImportModelEvaluationRequest.new

# Call the import_model_evaluation method.
result = client.import_model_evaluation request

# The returned object is of type Google::Cloud::AIPlatform::V1::ModelEvaluation.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new ModelService client object.

Yields
  • (config) — Configure the ModelService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::AIPlatform::V1::ModelService::Client.new do |config|
  config.timeout = 10.0
end

#list_model_evaluation_slices

def list_model_evaluation_slices(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice>
def list_model_evaluation_slices(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice>

Lists ModelEvaluationSlices in a ModelEvaluation.

Overloads
def list_model_evaluation_slices(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice>
Pass arguments to list_model_evaluation_slices via a request object, either of type ListModelEvaluationSlicesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListModelEvaluationSlicesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_model_evaluation_slices(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice>
Pass arguments to list_model_evaluation_slices via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the ModelEvaluation to list the ModelEvaluationSlices from. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}
  • filter (::String) —

    The standard list filter.

    • slice.dimension - for =.
  • page_size (::Integer) — The standard list page size.
  • page_token (::String) — The standard list page token. Typically obtained via ListModelEvaluationSlicesResponse.next_page_token of the previous ModelService.ListModelEvaluationSlices call.
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — Mask specifying which fields to read.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListModelEvaluationSlicesRequest.new

# Call the list_model_evaluation_slices method.
result = client.list_model_evaluation_slices request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::ModelEvaluationSlice.
  p response
end

#list_model_evaluations

def list_model_evaluations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluation>
def list_model_evaluations(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluation>

Lists ModelEvaluations in a Model.

Overloads
def list_model_evaluations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluation>
Pass arguments to list_model_evaluations via a request object, either of type ListModelEvaluationsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListModelEvaluationsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_model_evaluations(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::ModelEvaluation>
Pass arguments to list_model_evaluations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the Model to list the ModelEvaluations from. Format: projects/{project}/locations/{location}/models/{model}
  • filter (::String) — The standard list filter.
  • page_size (::Integer) — The standard list page size.
  • page_token (::String) — The standard list page token. Typically obtained via ListModelEvaluationsResponse.next_page_token of the previous ModelService.ListModelEvaluations call.
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — Mask specifying which fields to read.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListModelEvaluationsRequest.new

# Call the list_model_evaluations method.
result = client.list_model_evaluations request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::ModelEvaluation.
  p response
end

#list_model_versions

def list_model_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
def list_model_versions(name: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>

Lists versions of the specified model.

Overloads
def list_model_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
Pass arguments to list_model_versions via a request object, either of type ListModelVersionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListModelVersionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_model_versions(name: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
Pass arguments to list_model_versions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the model to list versions for.
  • page_size (::Integer) — The standard list page size.
  • page_token (::String) — The standard list page token. Typically obtained via ListModelVersionsResponse.next_page_token of the previous [ModelService.ListModelversions][] call.
  • filter (::String) —

    An expression for filtering the results of the request. For field names both snake_case and camelCase are supported.

    • labels supports general map functions that is:
      • labels.key=value - key:value equality
      • `labels.key:* or labels:key - key existence
      • A key including a space must be quoted. labels."a key".

    Some examples:

    • labels.myKey="myValue"
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — Mask specifying which fields to read.
  • order_by (::String) — A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • create_time
    • update_time

    Example: update_time asc, create_time desc.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListModelVersionsRequest.new

# Call the list_model_versions method.
result = client.list_model_versions request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::Model.
  p response
end

#list_models

def list_models(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
def list_models(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>

Lists Models in a Location.

Overloads
def list_models(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
Pass arguments to list_models via a request object, either of type ListModelsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListModelsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_models(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Model>
Pass arguments to list_models via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the Location to list the Models from. Format: projects/{project}/locations/{location}
  • filter (::String) —

    An expression for filtering the results of the request. For field names both snake_case and camelCase are supported.

    • model supports = and !=. model represents the Model ID, i.e. the last segment of the Model's [resource name][google.cloud.aiplatform.v1.Model.name].
    • display_name supports = and !=
    • labels supports general map functions that is:
      • labels.key=value - key:value equality
      • `labels.key:* or labels:key - key existence
      • A key including a space must be quoted. labels."a key".

    Some examples:

    • model=1234
    • displayName="myDisplayName"
    • labels.myKey="myValue"
  • page_size (::Integer) — The standard list page size.
  • page_token (::String) — The standard list page token. Typically obtained via ListModelsResponse.next_page_token of the previous ModelService.ListModels call.
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — Mask specifying which fields to read.
  • order_by (::String) — A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • display_name
    • create_time
    • update_time

    Example: display_name, create_time desc.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListModelsRequest.new

# Call the list_models method.
result = client.list_models request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::Model.
  p response
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#merge_version_aliases

def merge_version_aliases(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
def merge_version_aliases(name: nil, version_aliases: nil) -> ::Google::Cloud::AIPlatform::V1::Model

Merges a set of aliases for a Model version.

Overloads
def merge_version_aliases(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to merge_version_aliases via a request object, either of type Google::Cloud::AIPlatform::V1::MergeVersionAliasesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::MergeVersionAliasesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def merge_version_aliases(name: nil, version_aliases: nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to merge_version_aliases via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the model version to merge aliases, with a version ID explicitly included.

    Example: projects/{project}/locations/{location}/models/{model}@1234

  • version_aliases (::Array<::String>) — Required. The set of version aliases to merge. The alias should be at most 128 characters, and match [a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]. Add the - prefix to an alias means removing that alias from the version. - is NOT counted in the 128 characters. Example: -golden means removing the golden alias from the version.

    There is NO ordering in aliases, which means 1) The aliases returned from GetModel API might not have the exactly same order from this MergeVersionAliases API. 2) Adding and deleting the same alias in the request is not recommended, and the 2 operations will be cancelled out.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::MergeVersionAliasesRequest.new

# Call the merge_version_aliases method.
result = client.merge_version_aliases request

# The returned object is of type Google::Cloud::AIPlatform::V1::Model.
p result

#operations_client

def operations_client() -> ::Google::Cloud::AIPlatform::V1::ModelService::Operations

Get the associated client for long-running operations.

#update_model

def update_model(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
def update_model(model: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Model

Updates a Model.

Overloads
def update_model(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to update_model via a request object, either of type UpdateModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::UpdateModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_model(model: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Model
Pass arguments to update_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • model (::Google::Cloud::AIPlatform::V1::Model, ::Hash) —

    Required. The Model which replaces the resource on the server. When Model Versioning is enabled, the model.name will be used to determine whether to update the model or model version.

    1. model.name with the @ value, e.g. models/123@1, refers to a version specific update.
    2. model.name without the @ value, e.g. models/123, refers to a model update.
    3. model.name with @-, e.g. models/123@-, refers to a model update.
    4. Supported model fields: display_name, description; supported version-specific fields: version_description. Labels are supported in both scenarios. Both the model labels and the version labels are merged when a model is returned. When updating labels, if the request is for model-specific update, model label gets updated. Otherwise, version labels get updated.
    5. A model name or model version name fields update mismatch will cause a precondition error.
    6. One request cannot update both the model and the version fields. You must update them separately.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. The update mask applies to the resource. For the FieldMask definition, see google.protobuf.FieldMask.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::UpdateModelRequest.new

# Call the update_model method.
result = client.update_model request

# The returned object is of type Google::Cloud::AIPlatform::V1::Model.
p result

#upload_model

def upload_model(request, options = nil) -> ::Gapic::Operation
def upload_model(parent: nil, parent_model: nil, model_id: nil, model: nil, service_account: nil) -> ::Gapic::Operation

Uploads a Model artifact into Vertex AI.

Overloads
def upload_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to upload_model via a request object, either of type UploadModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::UploadModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def upload_model(parent: nil, parent_model: nil, model_id: nil, model: nil, service_account: nil) -> ::Gapic::Operation
Pass arguments to upload_model via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the Location into which to upload the Model. Format: projects/{project}/locations/{location}
  • parent_model (::String) — Optional. The resource name of the model into which to upload the version. Only specify this field when uploading a new version.
  • model_id (::String) — Optional. The ID to use for the uploaded Model, which will become the final component of the model resource name.

    This value may be up to 63 characters, and valid characters are [a-z0-9_-]. The first character cannot be a number or hyphen.

  • model (::Google::Cloud::AIPlatform::V1::Model, ::Hash) — Required. The Model to create.
  • service_account (::String) — Optional. The user-provided custom service account to use to do the model upload. If empty, Vertex AI Service Agent will be used. Users uploading the Model must have the iam.serviceAccounts.actAs permission on this service account. Also, this account must belong to the project specified in the parent field and have all necessary read permissions.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AIPlatform::V1::ModelService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::UploadModelRequest.new

# Call the upload_model method.
result = client.upload_model request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end