Retail V2 API - Class Google::Cloud::Retail::V2::ModelService::Rest::Client (v0.16.1)

Reference documentation and code samples for the Retail V2 API class Google::Cloud::Retail::V2::ModelService::Rest::Client.

REST client for the ModelService service.

Service for performing CRUD operations on models. Recommendation models contain all the metadata necessary to generate a set of models for the Predict() API. A model is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. Frequently Bought Together on Home Page).

This service allows you to do the following:

  • Initiate training of a model.
  • Pause training of an existing model.
  • List all the available models along with their metadata.
  • Control their tuning schedule.

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::Retail::V2::ModelService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#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

#create_model

def create_model(request, options = nil) -> ::Gapic::Operation
def create_model(parent: nil, model: nil, dry_run: nil) -> ::Gapic::Operation

Creates a new model.

Overloads
def create_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_model via a request object, either of type CreateModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::CreateModelRequest, ::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 create_model(parent: nil, model: nil, dry_run: nil) -> ::Gapic::Operation
Pass arguments to create_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 parent resource under which to create the model. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
  • model (::Google::Cloud::Retail::V2::Model, ::Hash) — Required. The payload of the Model to create.
  • dry_run (::Boolean) — Optional. Whether to run a dry run to validate the request (without actually creating the model).
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#delete_model

def delete_model(request, options = nil) -> ::Google::Protobuf::Empty
def delete_model(name: nil) -> ::Google::Protobuf::Empty

Deletes an existing model.

Overloads
def delete_model(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_model via a request object, either of type DeleteModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::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) -> ::Google::Protobuf::Empty
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 resource name of the Model to delete. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#get_model

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

Gets a model.

Overloads
def get_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to get_model via a request object, either of type GetModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::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::Retail::V2::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 resource name of the Model to get. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#initialize

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

Create a new ModelService REST 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::Retail::V2::ModelService::Rest::Client.new

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

#list_models

def list_models(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>
def list_models(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>

Lists all the models linked to this event store.

Overloads
def list_models(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>
Pass arguments to list_models via a request object, either of type ListModelsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::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, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::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 parent for which to list models. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
  • page_size (::Integer) — Optional. Maximum number of results to return. If unspecified, defaults to 50. Max allowed value is 1000.
  • page_token (::String) — Optional. A page token, received from a previous ListModels call. Provide this to retrieve the subsequent page.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#location_client

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

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

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

#operations_client

def operations_client() -> ::Google::Cloud::Retail::V2::ModelService::Rest::Operations

Get the associated client for long-running operations.

#pause_model

def pause_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
def pause_model(name: nil) -> ::Google::Cloud::Retail::V2::Model

Pauses the training of an existing model.

Overloads
def pause_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to pause_model via a request object, either of type PauseModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::PauseModelRequest, ::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 pause_model(name: nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to pause_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 to pause. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#resume_model

def resume_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
def resume_model(name: nil) -> ::Google::Cloud::Retail::V2::Model

Resumes the training of an existing model.

Overloads
def resume_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to resume_model via a request object, either of type ResumeModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::ResumeModelRequest, ::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 resume_model(name: nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to resume_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 to resume. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#tune_model

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

Tunes an existing model.

Overloads
def tune_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to tune_model via a request object, either of type TuneModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::TuneModelRequest, ::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 tune_model(name: nil) -> ::Gapic::Operation
Pass arguments to tune_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 resource name of the model to tune. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#update_model

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

Update of model metadata. Only fields that currently can be updated are: filtering_option and periodic_tuning_state. If other values are provided, this API method ignores them.

Overloads
def update_model(request, options = nil) -> ::Google::Cloud::Retail::V2::Model
Pass arguments to update_model via a request object, either of type UpdateModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Retail::V2::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::Retail::V2::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
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.