Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::ConversationModels::Client (v0.17.1)

Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::ConversationModels::Client.

Client for the ConversationModels service.

Manages a collection of models for human agent assistant.

Inherits

  • Object

Methods

.configure

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

Configure the ConversationModels 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 ConversationModels clients
::Google::Cloud::Dialogflow::V2::ConversationModels::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the ConversationModels 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_conversation_model

def create_conversation_model(request, options = nil) -> ::Gapic::Operation
def create_conversation_model(parent: nil, conversation_model: nil) -> ::Gapic::Operation

Creates a model.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Overloads
def create_conversation_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_conversation_model via a request object, either of type Google::Cloud::Dialogflow::V2::CreateConversationModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateConversationModelRequest, ::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_conversation_model(parent: nil, conversation_model: nil) -> ::Gapic::Operation
Pass arguments to create_conversation_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
  • (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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::CreateConversationModelRequest.new

# Call the create_conversation_model method.
result = client.create_conversation_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

#create_conversation_model_evaluation

def create_conversation_model_evaluation(request, options = nil) -> ::Gapic::Operation
def create_conversation_model_evaluation(parent: nil, conversation_model_evaluation: nil) -> ::Gapic::Operation

Creates evaluation of a conversation model.

Overloads
def create_conversation_model_evaluation(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_conversation_model_evaluation via a request object, either of type Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest, ::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_conversation_model_evaluation(parent: nil, conversation_model_evaluation: nil) -> ::Gapic::Operation
Pass arguments to create_conversation_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 conversation model resource name. Format: projects/<Project ID>/locations/<Location ID>/conversationModels/<Conversation Model ID>
  • conversation_model_evaluation (::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation, ::Hash) — Required. The conversation model evaluation to be created.
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest.new

# Call the create_conversation_model_evaluation method.
result = client.create_conversation_model_evaluation 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_conversation_model

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

Deletes a model.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Overloads
def delete_conversation_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_conversation_model via a request object, either of type DeleteConversationModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest, ::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_conversation_model(name: nil) -> ::Gapic::Operation
Pass arguments to delete_conversation_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 conversation model to delete. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest.new

# Call the delete_conversation_model method.
result = client.delete_conversation_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

#deploy_conversation_model

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

Deploys a model. If a model is already deployed, deploying it has no effect. A model can only serve prediction requests after it gets deployed. For article suggestion, custom model will not be used unless it is deployed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Overloads
def deploy_conversation_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to deploy_conversation_model via a request object, either of type DeployConversationModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::DeployConversationModelRequest, ::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 deploy_conversation_model(name: nil) -> ::Gapic::Operation
Pass arguments to deploy_conversation_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 conversation model to deploy. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::DeployConversationModelRequest.new

# Call the deploy_conversation_model method.
result = client.deploy_conversation_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_conversation_model

def get_conversation_model(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModel
def get_conversation_model(name: nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModel

Gets conversation model.

Overloads
def get_conversation_model(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModel
Pass arguments to get_conversation_model via a request object, either of type GetConversationModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetConversationModelRequest, ::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_conversation_model(name: nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModel
Pass arguments to get_conversation_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 conversation model to retrieve. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::GetConversationModelRequest.new

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

# The returned object is of type Google::Cloud::Dialogflow::V2::ConversationModel.
p result

#get_conversation_model_evaluation

def get_conversation_model_evaluation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation
def get_conversation_model_evaluation(name: nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation

Gets an evaluation of conversation model.

Overloads
def get_conversation_model_evaluation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation
Pass arguments to get_conversation_model_evaluation via a request object, either of type GetConversationModelEvaluationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest, ::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_conversation_model_evaluation(name: nil) -> ::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation
Pass arguments to get_conversation_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 conversation model evaluation resource name. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>/evaluations/<Evaluation ID>
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest.new

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

# The returned object is of type Google::Cloud::Dialogflow::V2::ConversationModelEvaluation.
p result

#initialize

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

Create a new ConversationModels client object.

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

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

#list_conversation_model_evaluations

def list_conversation_model_evaluations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>
def list_conversation_model_evaluations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>

Lists evaluations of a conversation model.

Overloads
def list_conversation_model_evaluations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>
Pass arguments to list_conversation_model_evaluations via a request object, either of type ListConversationModelEvaluationsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest, ::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_conversation_model_evaluations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>
Pass arguments to list_conversation_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 conversation model resource name. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>
  • page_size (::Integer) — Optional. Maximum number of evaluations to return in a single page. By default 100 and at most 1000.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list request.
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest.new

# Call the list_conversation_model_evaluations method.
result = client.list_conversation_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::Dialogflow::V2::ConversationModelEvaluation.
  p response
end

#list_conversation_models

def list_conversation_models(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>
def list_conversation_models(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>

Lists conversation models.

Overloads
def list_conversation_models(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>
Pass arguments to list_conversation_models via a request object, either of type ListConversationModelsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListConversationModelsRequest, ::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_conversation_models(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>
Pass arguments to list_conversation_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 project to list all conversation models for. Format: projects/<Project ID>
  • page_size (::Integer) — Optional. Maximum number of conversation models to return in a single page. By default 100 and at most 1000.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list request.
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ListConversationModelsRequest.new

# Call the list_conversation_models method.
result = client.list_conversation_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::Dialogflow::V2::ConversationModel.
  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)

#operations_client

def operations_client() -> ::Google::Cloud::Dialogflow::V2::ConversationModels::Operations

Get the associated client for long-running operations.

#undeploy_conversation_model

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

Undeploys a model. If the model is not deployed this method has no effect. If the model is currently being used:

  • For article suggestion, article suggestion will fallback to the default model if model is undeployed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Overloads
def undeploy_conversation_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to undeploy_conversation_model via a request object, either of type UndeployConversationModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest, ::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 undeploy_conversation_model(name: nil) -> ::Gapic::Operation
Pass arguments to undeploy_conversation_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 conversation model to undeploy. Format: projects/<Project ID>/conversationModels/<Conversation Model ID>
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/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest.new

# Call the undeploy_conversation_model method.
result = client.undeploy_conversation_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