Service Client: Google::Cloud::Dialogflow::V2beta1::Session::SessionsClient

Client stub representing the remote Sessions gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to dialogflow.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Cloud::Dialogflow::V2beta1::Session - Compiled Protocol Buffers messages for google/cloud/dialogflow/v2beta1/session.proto

SYNOPSIS

use Google::Cloud::Dialogflow::V2beta1::Session;

my $msg = Google::Cloud::Dialogflow::V2beta1::Session::DetectIntentRequest->new({
    session => $session,
    query_params => $query_params,
    query_input => $query_input,
    output_audio_config => $output_audio_config,
});

# Read or update a field
my $val = $msg->session();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Dialogflow::V2beta1::Session::DetectIntentRequest->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/dialogflow/v2beta1/session.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Dialogflow::V2beta1::Session::DetectIntentRequest

The request to detect user's intent.

Inherits from Protobuf::Message.

Accessors

  • $msg->session() / $msg->session($value)

    Type: String

    Required. The name of the session this query is sent to. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`,

    If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment (`Environment ID` might be referred to as environment name at some places). If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters. For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview).

    Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

  • $msg->query_params() / $msg->query_params($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryParameters)

    The parameters of this query.

  • $msg->query_input() / $msg->query_input($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryInput)

    Required. The input specification. It can be set to:

    1. an audio config which instructs the speech recognizer how to process the speech audio,

    2. a conversational query in the form of text, or

    3. an event that specifies which intent to trigger.

  • $msg->output_audio_config() / $msg->output_audio_config($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::OutputAudioConfig)

    Instructs the speech synthesizer how to generate the output audio. If this field is not set and agent-level speech synthesizer is not configured, no output audio is generated.

  • $msg->output_audio_config_mask() / $msg->output_audio_config_mask($value)

    Type: Message (Google::Protobuf::FieldMask::FieldMask)

    Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] indicating which settings in this request-level config should override speech synthesizer settings defined at agent-level.

    If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] replaces the agent-level config in its entirety.

  • $msg->input_audio() / $msg->input_audio($value)

    Type: Bytes

    The natural language speech audio to be processed. This field should be populated iff `query_input` is set to an input audio config. A single request can contain up to 1 minute of speech audio data.

Google::Cloud::Dialogflow::V2beta1::Session::DetectIntentResponse

The message returned from the DetectIntent method.

Inherits from Protobuf::Message.

Accessors

  • $msg->response_id() / $msg->response_id($value)

    Type: String

    The unique identifier of the response. It can be used to locate a response in the training example set or for reporting issues.

  • $msg->query_result() / $msg->query_result($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryResult)

    The selected results of the conversational query or event processing. See `alternative_query_results` for additional potential results.

  • $msg->alternative_query_results() / $msg->alternative_query_results($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryResult)

    If Knowledge Connectors are enabled, there could be more than one result returned for a given query or event, and this field will contain all results except for the top one, which is captured in query_result. The alternative results are ordered by decreasing `QueryResult.intent_detection_confidence`. If Knowledge Connectors are disabled, this field will be empty until multiple responses for regular intents are supported, at which point those additional results will be surfaced here.

  • $msg->webhook_status() / $msg->webhook_status($value)

    Type: Message (Google::Rpc::Status::Status)

    Specifies the status of the webhook request.

  • $msg->output_audio() / $msg->output_audio($value)

    Type: Bytes

    The audio data bytes encoded as specified in the request. Note: The output audio is generated based on the values of default platform text responses found in the `query_result.fulfillment_messages` field. If multiple default text responses exist, they will be concatenated when generating audio. If no default platform text responses exist, the generated audio content will be empty.

    In some scenarios, multiple output audio fields may be present in the response structure. In these cases, only the top-most-level audio output has content.

  • $msg->output_audio_config() / $msg->output_audio_config($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::OutputAudioConfig)

    The config used by the speech synthesizer to generate the output audio.

Google::Cloud::Dialogflow::V2beta1::Session::QueryParameters

Represents the parameters of the conversational query.

Inherits from Protobuf::Message.

Accessors

  • $msg->time_zone() / $msg->time_zone($value)

    Type: String

    The time zone of this conversational query from the [time zone database](https://www.iana.org/time-zones), e.g., America/New_York, Europe/Paris. If not provided, the time zone specified in agent settings is used.

  • $msg->geo_location() / $msg->geo_location($value)

    Type: Message (Google::Type::Latlng::LatLng)

    The geo location of this conversational query.

  • $msg->contexts() / $msg->contexts($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Context::Context)

    The collection of contexts to be activated before this query is executed.

  • $msg->reset_contexts() / $msg->reset_contexts($value)

    Type: Bool

    Specifies whether to delete all contexts in the current session before the new ones are activated.

  • $msg->session_entity_types() / $msg->session_entity_types($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::SessionEntityType::SessionEntityType)

    Additional session entity types to replace or extend developer entity types with. The entity synonyms apply to all languages and persist for the session of this query.

  • $msg->payload() / $msg->payload($value)

    Type: Message (Google::Protobuf::Struct::Struct)

    This field can be used to pass custom data to your webhook. Arbitrary JSON objects are supported. If supplied, the value is used to populate the `WebhookRequest.original_detect_intent_request.payload` field sent to your webhook.

  • $msg->knowledge_base_names() / $msg->knowledge_base_names($value)

    Type: String

    KnowledgeBases to get alternative results from. If not set, the KnowledgeBases enabled in the agent (through UI) will be used. Format: `projects/<Project ID>/knowledgeBases/<Knowledge Base ID>`.

  • $msg->sentiment_analysis_request_config() / $msg->sentiment_analysis_request_config($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::SentimentAnalysisRequestConfig)

    Configures the type of sentiment analysis to perform. If not provided, sentiment analysis is not performed. Note: Sentiment Analysis is only currently available for Essentials Edition agents.

  • $msg->sub_agents() / $msg->sub_agents($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Agent::SubAgent)

    For mega agent query, directly specify which sub agents to query. If any specified sub agent is not linked to the mega agent, an error will be returned. If empty, Dialogflow will decide which sub agents to query. If specified for a non-mega-agent query, will be silently ignored.

  • $msg->webhook_headers() / $msg->webhook_headers($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryParameters::WebhookHeadersEntry)

    This field can be used to pass HTTP headers for a webhook call. These headers will be sent to webhook along with the headers that have been configured through Dialogflow web console. The headers defined within this field will overwrite the headers configured through Dialogflow console if there is a conflict. Header names are case-insensitive. Google's specified headers are not allowed. Including: "Host", "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.

  • $msg->platform() / $msg->platform($value)

    Type: String

    The platform of the virtual agent response messages.

    If not empty, only emits messages from this platform in the response. Valid values are the enum names of [platform][google.cloud.dialogflow.v2beta1.Intent.Message.platform].

Google::Cloud::Dialogflow::V2beta1::Session::QueryInput

Represents the query input. It can contain either:

1. An audio config which instructs the speech recognizer how to process the speech audio.

2. A conversational query in the form of text.

3. An event that specifies which intent to trigger.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Dialogflow::V2beta1::Session::QueryResult

Represents the result of conversational query or event processing.

Inherits from Protobuf::Message.

Accessors

  • $msg->query_text() / $msg->query_text($value)

    Type: String

    The original conversational query text:

    - If natural language text was provided as input, `query_text` contains a copy of the input. - If natural language speech audio was provided as input, `query_text` contains the speech recognition result. If speech recognizer produced multiple alternatives, a particular one is picked. - If automatic spell correction is enabled, `query_text` will contain the corrected user input.

  • $msg->language_code() / $msg->language_code($value)

    Type: String

    The language that was triggered during intent detection. See [Language Support](https://cloud.google.com/dialogflow/docs/reference/language) for a list of the currently supported language codes.

  • $msg->speech_recognition_confidence() / $msg->speech_recognition_confidence($value)

    Type: Float

    The Speech recognition confidence between 0.0 and 1.0. A higher number indicates an estimated greater likelihood that the recognized words are correct. The default of 0.0 is a sentinel value indicating that confidence was not set.

    This field is not guaranteed to be accurate or set. In particular this field isn't set for StreamingDetectIntent since the streaming endpoint has separate confidence estimates per portion of the audio in StreamingRecognitionResult.

  • $msg->action() / $msg->action($value)

    Type: String

    The action name from the matched intent.

  • $msg->parameters() / $msg->parameters($value)

    Type: Message (Google::Protobuf::Struct::Struct)

    The collection of extracted parameters.

    Depending on your protocol or client library language, this is a map, associative array, symbol table, dictionary, or JSON object composed of a collection of (MapKey, MapValue) pairs:

    * MapKey type: string * MapKey value: parameter name * MapValue type: If parameter's entity type is a composite entity then use map, otherwise, depending on the parameter value type, it could be one of string, number, boolean, null, list or map. * MapValue value: If parameter's entity type is a composite entity then use map from composite entity property names to property values, otherwise, use parameter value.

  • $msg->all_required_params_present() / $msg->all_required_params_present($value)

    Type: Bool

    This field is set to:

    - `false` if the matched intent has required parameters and not all of the required parameter values have been collected. - `true` if all required parameter values have been collected, or if the matched intent doesn't contain any required parameters.

  • $msg->cancels_slot_filling() / $msg->cancels_slot_filling($value)

    Type: Bool

    Indicates whether the conversational query triggers a cancellation for slot filling. For more information, see the [cancel slot filling documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).

  • $msg->fulfillment_text() / $msg->fulfillment_text($value)

    Type: String

    The text to be pronounced to the user or shown on the screen. Note: This is a legacy field, `fulfillment_messages` should be preferred.

  • $msg->fulfillment_messages() / $msg->fulfillment_messages($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Intent::Intent::Message)

    The collection of rich messages to present to the user.

  • $msg->webhook_source() / $msg->webhook_source($value)

    Type: String

    If the query was fulfilled by a webhook call, this field is set to the value of the `source` field returned in the webhook response.

  • $msg->webhook_payload() / $msg->webhook_payload($value)

    Type: Message (Google::Protobuf::Struct::Struct)

    If the query was fulfilled by a webhook call, this field is set to the value of the `payload` field returned in the webhook response.

  • $msg->output_contexts() / $msg->output_contexts($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Context::Context)

    The collection of output contexts. If applicable, `output_contexts.parameters` contains entries with name `<parameter name>.original` containing the original parameter values before the query.

  • $msg->intent() / $msg->intent($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Intent::Intent)

    The intent that matched the conversational query. Some, not all fields are filled in this message, including but not limited to: `name`, `display_name`, `end_interaction` and `is_fallback`.

  • $msg->intent_detection_confidence() / $msg->intent_detection_confidence($value)

    Type: Float

    The intent detection confidence. Values range from 0.0 (completely uncertain) to 1.0 (completely certain). This value is for informational purpose only and is only used to help match the best intent within the classification threshold. This value may change for the same end-user expression at any time due to a model retraining or change in implementation. If there are `multiple knowledge_answers` messages, this value is set to the greatest `knowledgeAnswers.match_confidence` value in the list.

  • $msg->diagnostic_info() / $msg->diagnostic_info($value)

    Type: Message (Google::Protobuf::Struct::Struct)

    Free-form diagnostic information for the associated detect intent request. The fields of this data can change without notice, so you should not write code that depends on its structure. The data may contain:

    - webhook call latency - webhook errors

  • $msg->sentiment_analysis_result() / $msg->sentiment_analysis_result($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::SentimentAnalysisResult)

    The sentiment analysis result, which depends on the `sentiment_analysis_request_config` specified in the request.

  • $msg->knowledge_answers() / $msg->knowledge_answers($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::KnowledgeAnswers)

    The result from Knowledge Connector (if any), ordered by decreasing `KnowledgeAnswers.match_confidence`.

Google::Cloud::Dialogflow::V2beta1::Session::KnowledgeAnswers

Represents the result of querying a Knowledge base.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Dialogflow::V2beta1::Session::StreamingDetectIntentRequest

The top-level message sent by the client to the [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] method.

Multiple request messages should be sent in order:

1. The first message must contain [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] plus optionally [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. If the client wants to receive an audio response, it should also contain [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. The message must not contain [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. 2. If [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] was set to [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], all subsequent messages must contain [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] to continue with Speech recognition. If you decide to rather detect an intent from text input after you already started Speech recognition, please send a message with [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text].

However, note that:

* Dialogflow will bill you for the audio duration so far.
* Dialogflow discards all Speech recognition results in favor of the
  input text.
* Dialogflow will use the language code from the first message.

After you sent all input, you must half-close or abort the request stream.

Inherits from Protobuf::Message.

Accessors

  • $msg->session() / $msg->session($value)

    Type: String

    Required. The name of the session the query is sent to. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`,

    If `Location ID` is not specified we assume default 'us' location. If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we are using "-". It's up to the API caller to choose an appropriate `Session ID` and `User Id`. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the `Session ID` and `User ID` must not exceed 36 characters.

    For more information, see the [API interactions guide](https://cloud.google.com/dialogflow/docs/api-overview).

    Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).

  • $msg->query_params() / $msg->query_params($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryParameters)

    The parameters of this query.

  • $msg->query_input() / $msg->query_input($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryInput)

    Required. The input specification. It can be set to:

    1. an audio config which instructs the speech recognizer how to process the speech audio,

    2. a conversational query in the form of text, or

    3. an event that specifies which intent to trigger.

  • $msg->single_utterance() / $msg->single_utterance($value)

    Type: Bool

    DEPRECATED. Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] instead. If `false` (default), recognition does not cease until the client closes the stream. If `true`, the recognizer will detect a single spoken utterance in input audio. Recognition ceases when it detects the audio's voice has stopped or paused. In this case, once a detected intent is received, the client should close the stream and start a new request with a new stream as needed. This setting is ignored when `query_input` is a piece of text or an event.

  • $msg->output_audio_config() / $msg->output_audio_config($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::OutputAudioConfig)

    Instructs the speech synthesizer how to generate the output audio. If this field is not set and agent-level speech synthesizer is not configured, no output audio is generated.

  • $msg->output_audio_config_mask() / $msg->output_audio_config_mask($value)

    Type: Message (Google::Protobuf::FieldMask::FieldMask)

    Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this request-level config should override speech synthesizer settings defined at agent-level.

    If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level config in its entirety.

  • $msg->input_audio() / $msg->input_audio($value)

    Type: Bytes

    The input audio content to be recognized. Must be sent if `query_input` was set to a streaming input audio config. The complete audio over all streaming messages must not exceed 1 minute.

  • $msg->enable_debugging_info() / $msg->enable_debugging_info($value)

    Type: Bool

    If true, `StreamingDetectIntentResponse.debugging_info` will get populated.

Google::Cloud::Dialogflow::V2beta1::Session::CloudConversationDebuggingInfo

Cloud conversation info for easier debugging. It will get populated in `StreamingDetectIntentResponse` or `StreamingAnalyzeContentResponse` when the flag `enable_debugging_info` is set to true in corresponding requests.

Inherits from Protobuf::Message.

Accessors

  • $msg->audio_data_chunks() / $msg->audio_data_chunks($value)

    Type: Int32

    Number of input audio data chunks in streaming requests.

  • $msg->result_end_time_offset() / $msg->result_end_time_offset($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offset of the end of speech utterance relative to the beginning of the first audio chunk.

  • $msg->first_audio_duration() / $msg->first_audio_duration($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Duration of first audio chunk.

  • $msg->single_utterance() / $msg->single_utterance($value)

    Type: Bool

    Whether client used single utterance mode.

  • $msg->speech_partial_results_end_times() / $msg->speech_partial_results_end_times($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offsets of the speech partial results relative to the beginning of the stream.

  • $msg->speech_final_results_end_times() / $msg->speech_final_results_end_times($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offsets of the speech final results (is_final=true) relative to the beginning of the stream.

  • $msg->partial_responses() / $msg->partial_responses($value)

    Type: Int32

    Total number of partial responses.

  • $msg->speaker_id_passive_latency_ms_offset() / $msg->speaker_id_passive_latency_ms_offset($value)

    Type: Int32

    Time offset of Speaker ID stream close time relative to the Speech stream close time in milliseconds. Only meaningful for conversations involving passive verification.

  • $msg->bargein_event_triggered() / $msg->bargein_event_triggered($value)

    Type: Bool

    Whether a barge-in event is triggered in this request.

  • $msg->speech_single_utterance() / $msg->speech_single_utterance($value)

    Type: Bool

    Whether speech uses single utterance mode.

  • $msg->dtmf_partial_results_times() / $msg->dtmf_partial_results_times($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offsets of the DTMF partial results relative to the beginning of the stream.

  • $msg->dtmf_final_results_times() / $msg->dtmf_final_results_times($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offsets of the DTMF final results relative to the beginning of the stream.

  • $msg->single_utterance_end_time_offset() / $msg->single_utterance_end_time_offset($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offset of the end-of-single-utterance signal relative to the beginning of the stream.

  • $msg->no_speech_timeout() / $msg->no_speech_timeout($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    No speech timeout settings for the stream.

  • $msg->endpointing_timeout() / $msg->endpointing_timeout($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Speech endpointing timeout settings for the stream.

  • $msg->is_input_text() / $msg->is_input_text($value)

    Type: Bool

    Whether the streaming terminates with an injected text query.

  • $msg->client_half_close_time_offset() / $msg->client_half_close_time_offset($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Client half close time in terms of input audio duration.

  • $msg->client_half_close_streaming_time_offset() / $msg->client_half_close_streaming_time_offset($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Client half close time in terms of API streaming duration.

Google::Cloud::Dialogflow::V2beta1::Session::StreamingDetectIntentResponse

The top-level message returned from the `StreamingDetectIntent` method.

Multiple response messages can be returned in order:

1. If the `StreamingDetectIntentRequest.input_audio` field was set, the `recognition_result` field is populated for one or more messages. See the [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] message for details about the result message sequence.

2. The next message contains `response_id`, `query_result`, `alternative_query_results` and optionally `webhook_status` if a WebHook was called.

3. If `output_audio_config` was specified in the request or agent-level speech synthesizer is configured, all subsequent messages contain `output_audio` and `output_audio_config`.

Inherits from Protobuf::Message.

Accessors

  • $msg->response_id() / $msg->response_id($value)

    Type: String

    The unique identifier of the response. It can be used to locate a response in the training example set or for reporting issues.

  • $msg->recognition_result() / $msg->recognition_result($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::StreamingRecognitionResult)

    The result of speech recognition.

  • $msg->query_result() / $msg->query_result($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryResult)

    The selected results of the conversational query or event processing. See `alternative_query_results` for additional potential results.

  • $msg->alternative_query_results() / $msg->alternative_query_results($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::QueryResult)

    If Knowledge Connectors are enabled, there could be more than one result returned for a given query or event, and this field will contain all results except for the top one, which is captured in query_result. The alternative results are ordered by decreasing `QueryResult.intent_detection_confidence`. If Knowledge Connectors are disabled, this field will be empty until multiple responses for regular intents are supported, at which point those additional results will be surfaced here.

  • $msg->webhook_status() / $msg->webhook_status($value)

    Type: Message (Google::Rpc::Status::Status)

    Specifies the status of the webhook request.

  • $msg->output_audio() / $msg->output_audio($value)

    Type: Bytes

    The audio data bytes encoded as specified in the request. Note: The output audio is generated based on the values of default platform text responses found in the `query_result.fulfillment_messages` field. If multiple default text responses exist, they will be concatenated when generating audio. If no default platform text responses exist, the generated audio content will be empty.

    In some scenarios, multiple output audio fields may be present in the response structure. In these cases, only the top-most-level audio output has content.

  • $msg->output_audio_config() / $msg->output_audio_config($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::OutputAudioConfig)

    The config used by the speech synthesizer to generate the output audio.

  • $msg->debugging_info() / $msg->debugging_info($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::Session::CloudConversationDebuggingInfo)

    Debugging info that would get populated when `StreamingDetectIntentRequest.enable_debugging_info` is set to true.

Google::Cloud::Dialogflow::V2beta1::Session::StreamingRecognitionResult

Contains a speech recognition result corresponding to a portion of the audio that is currently being processed or an indication that this is the end of the single requested utterance.

While end-user audio is being processed, Dialogflow sends a series of results. Each result may contain a `transcript` value. A transcript represents a portion of the utterance. While the recognizer is processing audio, transcript values may be interim values or finalized values. Once a transcript is finalized, the `is_final` value is set to true and processing continues for the next transcript.

If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` was true, and the recognizer has completed processing audio, the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the following (last) result contains the last finalized transcript.

The complete end-user utterance is determined by concatenating the finalized transcript values received for the series of results.

In the following example, single utterance is enabled. In the case where single utterance is not enabled, result 8 would not occur.

``` Num | transcript | message_type | is_final --- | ------------------------ | ----------------------- | -------- 1 | "tube" | TRANSCRIPT | false 2 | "to be a" | TRANSCRIPT | false 3 | "to be" | TRANSCRIPT | false 4 | "to be or not to be" | TRANSCRIPT | true 5 | "that's" | TRANSCRIPT | false 6 | "that is | TRANSCRIPT | false 7 | " that is the question" | TRANSCRIPT | true 8 | unset | END_OF_SINGLE_UTTERANCE | unset 9 | ". Whether 'tis nobler" | TRANSCRIPT | true 10 | " in the mind" | TRANSCRIPT | false 11 | " in the mind to suffer" | TRANSCRIPT | true ```

Concatenating the finalized transcripts with `is_final` set to true, the complete utterance becomes "to be or not to be that is the question".

Inherits from Protobuf::Message.

Accessors

  • $msg->message_type() / $msg->message_type($value)

    Type: Enum (Google::Cloud::Dialogflow::V2beta1::StreamingRecognitionResult::MessageType)

    Type of the result message.

  • $msg->transcript() / $msg->transcript($value)

    Type: String

    Transcript text representing the words that the user spoke. Populated if and only if `message_type` = `TRANSCRIPT`.

  • $msg->is_final() / $msg->is_final($value)

    Type: Bool

    If `false`, the `StreamingRecognitionResult` represents an interim result that may change. If `true`, the recognizer will not return any further hypotheses about this piece of the audio. May only be populated for `message_type` = `TRANSCRIPT`.

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

    The Speech confidence between 0.0 and 1.0 for the current portion of audio. A higher number indicates an estimated greater likelihood that the recognized words are correct. The default of 0.0 is a sentinel value indicating that confidence was not set.

    This field is typically only provided if `is_final` is true and you should not rely on it being accurate or even set.

  • $msg->stability() / $msg->stability($value)

    Type: Float

    An estimate of the likelihood that the speech recognizer will not change its guess about this interim recognition result:

    * If the value is unspecified or 0.0, Dialogflow didn't compute the stability. In particular, Dialogflow will only provide stability for `TRANSCRIPT` results with `is_final = false`. * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely unstable and 1.0 means completely stable.

  • $msg->speech_word_info() / $msg->speech_word_info($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::SpeechWordInfo)

    Word-specific information for the words recognized by Speech in [transcript][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and [InputAudioConfig.enable_word_info] is set.

  • $msg->speech_end_offset() / $msg->speech_end_offset($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Time offset of the end of this Speech recognition result relative to the beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`.

  • $msg->language_code() / $msg->language_code($value)

    Type: String

    Detected language code for the transcript.

  • $msg->dtmf_digits() / $msg->dtmf_digits($value)

    Type: Message (Google::Cloud::Dialogflow::V2beta1::AudioConfig::TelephonyDtmfEvents)

    DTMF digits. Populated if and only if `message_type` = `DTMF_DIGITS`.

Enum: StreamingRecognitionResult::MessageType

  • MESSAGE_TYPE_UNSPECIFIED => 0

  • TRANSCRIPT => 1

  • END_OF_SINGLE_UTTERANCE => 2

  • DTMF_DIGITS => 3

  • PARTIAL_DTMF_DIGITS => 4

  • SPEECH_ACTIVITY_BEGIN => 5

  • SPEECH_ACTIVITY_END => 6

Google::Cloud::Dialogflow::V2beta1::Session::TextInput

Represents the natural language text to be processed.

Inherits from Protobuf::Message.

Accessors

  • $msg->text() / $msg->text($value)

    Type: String

    Optional. The UTF-8 encoded natural language text to be processed. Text length must not exceed 256 characters for virtual agent interactions. Only one of `text` and `companion_query` should be set - not both.

  • $msg->language_code() / $msg->language_code($value)

    Type: String

    Required. The language of this conversational query. See [Language Support](https://cloud.google.com/dialogflow/docs/reference/language) for a list of the currently supported language codes. Note that queries in the same session do not necessarily need to specify the same language.

Google::Cloud::Dialogflow::V2beta1::Session::EventInput

Events allow for matching intents by event name instead of the natural language input. For instance, input `<event: { name: "welcome_event", parameters: { name: "Sam" } }>` can trigger a personalized welcome response. The parameter `name` may be used by the agent in the response: `"Hello #welcome_event.name! What can I do for you today?"`.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    Required. The unique identifier of the event.

  • $msg->parameters() / $msg->parameters($value)

    Type: Message (Google::Protobuf::Struct::Struct)

    The collection of parameters associated with the event.

    Depending on your protocol or client library language, this is a map, associative array, symbol table, dictionary, or JSON object composed of a collection of (MapKey, MapValue) pairs:

    * MapKey type: string * MapKey value: parameter name * MapValue type: If parameter's entity type is a composite entity then use map, otherwise, depending on the parameter value type, it could be one of string, number, boolean, null, list or map. * MapValue value: If parameter's entity type is a composite entity then use map from composite entity property names to property values, otherwise, use parameter value.

  • $msg->language_code() / $msg->language_code($value)

    Type: String

    Required. The language of this query. See [Language Support](https://cloud.google.com/dialogflow/docs/reference/language) for a list of the currently supported language codes. Note that queries in the same session do not necessarily need to specify the same language.

    This field is ignored when used in the context of a [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2beta1.WebhookResponse.followup_event_input] field, because the language was already defined in the originating detect intent request.

Google::Cloud::Dialogflow::V2beta1::Session::SentimentAnalysisRequestConfig

Configures the types of sentiment analysis to perform.

Inherits from Protobuf::Message.

Accessors

  • $msg->analyze_query_text_sentiment() / $msg->analyze_query_text_sentiment($value)

    Type: Bool

    Instructs the service to perform sentiment analysis on `query_text`. If not provided, sentiment analysis is not performed on `query_text`.

Google::Cloud::Dialogflow::V2beta1::Session::SentimentAnalysisResult

The result of sentiment analysis. Sentiment analysis inspects user input and identifies the prevailing subjective opinion, especially to determine a user's attitude as positive, negative, or neutral. For [Participants.DetectIntent][], it needs to be configured in [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. For [Participants.StreamingDetectIntent][], it needs to be configured in [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_agent_assistant_config]

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Dialogflow::V2beta1::Session::Sentiment

The sentiment, such as positive/negative feeling or association, for a unit of analysis, such as the query text. See: https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values for how to interpret the result.

Inherits from Protobuf::Message.

Accessors

  • $msg->score() / $msg->score($value)

    Type: Float

    Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

  • $msg->magnitude() / $msg->magnitude($value)

    Type: Float

    A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment, regardless of score (positive or negative).

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Dialogflow::V2beta1::Session::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.