Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Conversations::Rest::Client (v0.24.0)

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

REST client for the Conversations service.

Service for managing Conversations.

Inherits

  • Object

Methods

.configure

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

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

#complete_conversation

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

Completes the specified conversation. Finished conversations are purged from the database after 30 days.

Overloads
def complete_conversation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to complete_conversation via a request object, either of type Google::Cloud::Dialogflow::V2::CompleteConversationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CompleteConversationRequest, ::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 complete_conversation(name: nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to complete_conversation 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. Resource identifier of the conversation to close. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#configure

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

Configure the Conversations 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

def create_conversation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
def create_conversation(parent: nil, conversation: nil, conversation_id: nil) -> ::Google::Cloud::Dialogflow::V2::Conversation

Creates a new conversation. Conversations are auto-completed after 24 hours.

Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage.

For Automated Agent Stage, there will be a dialogflow agent responding to user queries.

For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation.

If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from Automated Agent Stage, otherwise, it will start from Assist Stage. And during Automated Agent Stage, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.

Overloads
def create_conversation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to create_conversation via a request object, either of type Google::Cloud::Dialogflow::V2::CreateConversationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateConversationRequest, ::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(parent: nil, conversation: nil, conversation_id: nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to create_conversation 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. Resource identifier of the project creating the conversation. Format: projects/<Project ID>/locations/<Location ID>.
  • conversation (::Google::Cloud::Dialogflow::V2::Conversation, ::Hash) — Required. The conversation to create.
  • conversation_id (::String) —

    Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you.

    The conversation 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 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.

#generate_stateless_summary

def generate_stateless_summary(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse
def generate_stateless_summary(stateless_conversation: nil, conversation_profile: nil, latest_message: nil, max_context_size: nil) -> ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse

Generates and returns a summary for a conversation that does not have a resource created for it.

Overloads
def generate_stateless_summary(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse
Pass arguments to generate_stateless_summary via a request object, either of type GenerateStatelessSummaryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryRequest, ::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 generate_stateless_summary(stateless_conversation: nil, conversation_profile: nil, latest_message: nil, max_context_size: nil) -> ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse
Pass arguments to generate_stateless_summary 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
  • stateless_conversation (::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryRequest::MinimalConversation, ::Hash) — Required. The conversation to suggest a summary for.
  • conversation_profile (::Google::Cloud::Dialogflow::V2::ConversationProfile, ::Hash) — Required. A ConversationProfile containing information required for Summary generation. Required fields: {language_code, security_settings} Optional fields: {agent_assistant_config}
  • latest_message (::String) — The name of the latest conversation message used as context for generating a Summary. If empty, the latest message of the conversation will be used. The format is specific to the user and the names of the messages provided.
  • max_context_size (::Integer) — Max number of messages prior to and including [latest_message] to use as context when compiling the suggestion. By default 500 and at most 1000.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#get_conversation

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

Retrieves the specific conversation.

Overloads
def get_conversation(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to get_conversation via a request object, either of type GetConversationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetConversationRequest, ::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(name: nil) -> ::Google::Cloud::Dialogflow::V2::Conversation
Pass arguments to get_conversation 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 conversation. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation 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 Conversations REST client object.

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

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

#list_conversations

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

Returns the list of all conversations in the specified project.

Overloads
def list_conversations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>
Pass arguments to list_conversations via a request object, either of type ListConversationsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListConversationsRequest, ::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_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>
Pass arguments to list_conversations 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 from which to list all conversation. Format: projects/<Project ID>/locations/<Location ID>.
  • page_size (::Integer) — Optional. The maximum number of items 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.
  • filter (::String) — A filter expression that filters conversations listed in the response. In general, the expression must specify the field name, a comparison operator, and the value to use for filtering:

    • The value must be a string, a number, or a boolean.
    • The comparison operator must be either `=`,`!=`, `>`, or `<>
    • To filter on multiple expressions, separate the expressions with `AND` or `OR` (omitting both implies `AND`).
    • For clarity, expressions can be enclosed in parentheses.

    Only lifecycle_state can be filtered on in this way. For example, the following expression only returns COMPLETED conversations:

    lifecycle_state = "COMPLETED"

    For more information about filtering, see API Filtering.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#list_messages

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

Lists messages that belong to a given conversation. messages are ordered by create_time in descending order. To fetch updates without duplication, send request with filter create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token.

Overloads
def list_messages(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>
Pass arguments to list_messages via a request object, either of type ListMessagesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListMessagesRequest, ::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_messages(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>
Pass arguments to list_messages 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 conversation to list messages for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>
  • filter (::String) — Optional. Filter on message fields. Currently predicates on create_time and create_time_epoch_microseconds are supported. create_time only support milliseconds accuracy. E.g., create_time_epoch_microseconds > 1551790877964485 or create_time > 2017-01-15T01:30:15.01Z.

    For more information about filtering, see API Filtering.

  • page_size (::Integer) — Optional. The maximum number of items 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
  • (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)

#suggest_conversation_summary

def suggest_conversation_summary(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse
def suggest_conversation_summary(conversation: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse

Suggests summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.

Overloads
def suggest_conversation_summary(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse
Pass arguments to suggest_conversation_summary via a request object, either of type SuggestConversationSummaryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryRequest, ::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 suggest_conversation_summary(conversation: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse
Pass arguments to suggest_conversation_summary 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
  • conversation (::String) — Required. The conversation to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.
  • latest_message (::String) — The name of the latest conversation message used as context for compiling suggestion. If empty, the latest message of the conversation will be used.

    Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>.

  • context_size (::Integer) — Max number of messages prior to and including [latest_message] to use as context when compiling the suggestion. By default 500 and at most 1000.
  • assist_query_params (::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash) — Parameters for a human assist query.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.