Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Generators::Rest::Client (v1.2.0)

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

REST client for the Generators service.

Generator Service for LLM powered Agent Assist. This service manages the configurations of user owned Generators, such as description, context and instruction, input/output format, etc. The generator resources will be used inside a conversation and will be triggered by TriggerEvent to query LLM for answers.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the Generators 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_generator

def create_generator(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Generator
def create_generator(parent: nil, generator: nil, generator_id: nil) -> ::Google::Cloud::Dialogflow::V2::Generator

Creates a generator.

Overloads
def create_generator(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to create_generator via a request object, either of type CreateGeneratorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateGeneratorRequest, ::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_generator(parent: nil, generator: nil, generator_id: nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to create_generator 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/location to create generator for. Format: projects/<Project ID>/locations/<Location ID>
  • generator (::Google::Cloud::Dialogflow::V2::Generator, ::Hash) — Required. The generator to create.
  • generator_id (::String) —

    Optional. The ID to use for the generator, which will become the final component of the generator's resource name.

    The generator ID must be compliant with the regression fomula [a-zA-Z][a-zA-Z0-9_-]* with the characters length in range of [3,64]. If the field is not provided, an Id will be auto-generated. If the field is provided, the caller is resposible for

    1. the uniqueness of the ID, otherwise the request will be rejected.
    2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Generators::Rest::Client.new

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

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

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

#delete_generator

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

Deletes a generator.

Overloads
def delete_generator(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_generator via a request object, either of type DeleteGeneratorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::DeleteGeneratorRequest, ::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_generator(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_generator 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 generator resource name to delete. Format: projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Generators::Rest::Client.new

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

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

# The returned object is of type Google::Protobuf::Empty.
p result

#get_generator

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

Retrieves a generator.

Overloads
def get_generator(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to get_generator via a request object, either of type Google::Cloud::Dialogflow::V2::GetGeneratorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetGeneratorRequest, ::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_generator(name: nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to get_generator 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 generator resource name to retrieve. Format: projects/<Project ID>/locations/<Location ID>/generators/
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Generators::Rest::Client.new

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

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

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

#initialize

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

Create a new Generators REST client object.

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

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

#list_generators

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

Lists generators.

Overloads
def list_generators(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Generator>
Pass arguments to list_generators via a request object, either of type ListGeneratorsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListGeneratorsRequest, ::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_generators(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Generator>
Pass arguments to list_generators 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/location to list generators for. Format: projects/<Project ID>/locations/<Location ID>
  • page_size (::Integer) — Optional. Maximum number of conversation models to return in a single page. Default to 10.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call 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::Generators::Rest::Client.new

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

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Dialogflow::V2::Generator.
  p item
end

#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)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_generator

def update_generator(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Generator
def update_generator(generator: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Generator

Updates a generator.

Overloads
def update_generator(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to update_generator via a request object, either of type UpdateGeneratorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::UpdateGeneratorRequest, ::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_generator(generator: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Generator
Pass arguments to update_generator 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.
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::Generators::Rest::Client.new

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

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

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