Google Cloud Retail V2 Client - Class ModelServiceClient (1.4.2)

Reference documentation and code samples for the Google Cloud Retail V2 Client class ModelServiceClient.

Service Description: 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.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

This class is currently experimental and may be subject to changes. See Google\Cloud\Retail\V2\ModelServiceClient for the stable implementation

Namespace

Google \ Cloud \ Retail \ V2 \ Client

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

createModel

Parameters
NameDescription
request Google\Cloud\Retail\V2\CreateModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse

deleteModel

Deletes an existing model.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::deleteModelAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\DeleteModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

getModel

Parameters
NameDescription
request Google\Cloud\Retail\V2\GetModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Retail\V2\Model

listModels

Lists all the models linked to this event store.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::listModelsAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\ListModelsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse

pauseModel

Pauses the training of an existing model.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::pauseModelAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\PauseModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Retail\V2\Model

resumeModel

Resumes the training of an existing model.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::resumeModelAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\ResumeModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Retail\V2\Model

tuneModel

Tunes an existing model.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::tuneModelAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\TuneModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse

updateModel

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.

The async variant is Google\Cloud\Retail\V2\Client\ModelServiceClient::updateModelAsync() .

Parameters
NameDescription
request Google\Cloud\Retail\V2\UpdateModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Retail\V2\Model

createModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\CreateModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\DeleteModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\GetModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listModelsAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\ListModelsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

pauseModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\PauseModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

resumeModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\ResumeModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

tuneModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\TuneModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateModelAsync

Parameters
NameDescription
request Google\Cloud\Retail\V2\UpdateModelRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::catalogName

Formats a string containing the fully-qualified path to represent a catalog resource.

Parameters
NameDescription
project string
location string
catalog string
Returns
TypeDescription
stringThe formatted catalog resource.

static::modelName

Formats a string containing the fully-qualified path to represent a model resource.

Parameters
NameDescription
project string
location string
catalog string
model string
Returns
TypeDescription
stringThe formatted model resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • catalog: projects/{project}/locations/{location}/catalogs/{catalog}
  • model: projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.