1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.dialogflow.v2; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/dialogflow/v2/audio_config.proto"; 24import "google/cloud/dialogflow/v2/context.proto"; 25import "google/cloud/dialogflow/v2/intent.proto"; 26import "google/cloud/dialogflow/v2/session_entity_type.proto"; 27import "google/protobuf/duration.proto"; 28import "google/protobuf/field_mask.proto"; 29import "google/protobuf/struct.proto"; 30import "google/rpc/status.proto"; 31import "google/type/latlng.proto"; 32 33option cc_enable_arenas = true; 34option csharp_namespace = "Google.Cloud.Dialogflow.V2"; 35option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb"; 36option java_multiple_files = true; 37option java_outer_classname = "SessionProto"; 38option java_package = "com.google.cloud.dialogflow.v2"; 39option objc_class_prefix = "DF"; 40option (google.api.resource_definition) = { 41 type: "dialogflow.googleapis.com/Session" 42 pattern: "projects/{project}/agent/sessions/{session}" 43 pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" 44 pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" 45 pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" 46}; 47 48// A service used for session interactions. 49// 50// For more information, see the [API interactions 51// guide](https://cloud.google.com/dialogflow/docs/api-overview). 52service Sessions { 53 option (google.api.default_host) = "dialogflow.googleapis.com"; 54 option (google.api.oauth_scopes) = 55 "https://www.googleapis.com/auth/cloud-platform," 56 "https://www.googleapis.com/auth/dialogflow"; 57 58 // Processes a natural language query and returns structured, actionable data 59 // as a result. This method is not idempotent, because it may cause contexts 60 // and session entity types to be updated, which in turn might affect 61 // results of future queries. 62 // 63 // If you might use 64 // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) 65 // or other CCAI products now or in the future, consider using 66 // [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] 67 // instead of `DetectIntent`. `AnalyzeContent` has additional 68 // functionality for Agent Assist and other CCAI products. 69 // 70 // Note: Always use agent versions for production traffic. 71 // See [Versions and 72 // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). 73 rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { 74 option (google.api.http) = { 75 post: "/v2/{session=projects/*/agent/sessions/*}:detectIntent" 76 body: "*" 77 additional_bindings { 78 post: "/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" 79 body: "*" 80 } 81 additional_bindings { 82 post: "/v2/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" 83 body: "*" 84 } 85 additional_bindings { 86 post: "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" 87 body: "*" 88 } 89 }; 90 option (google.api.method_signature) = "session,query_input"; 91 } 92 93 // Processes a natural language query in audio format in a streaming fashion 94 // and returns structured, actionable data as a result. This method is only 95 // available via the gRPC API (not REST). 96 // 97 // If you might use 98 // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) 99 // or other CCAI products now or in the future, consider using 100 // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] 101 // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has 102 // additional functionality for Agent Assist and other CCAI products. 103 // 104 // Note: Always use agent versions for production traffic. 105 // See [Versions and 106 // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). 107 rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) 108 returns (stream StreamingDetectIntentResponse) {} 109} 110 111// The request to detect user's intent. 112message DetectIntentRequest { 113 // Required. The name of the session this query is sent to. Format: 114 // `projects/<Project ID>/agent/sessions/<Session ID>`, or 115 // `projects/<Project ID>/agent/environments/<Environment ID>/users/<User 116 // ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume 117 // default 'draft' environment (`Environment ID` might be referred to as 118 // environment name at some places). If `User ID` is not specified, we are 119 // using "-". It's up to the API caller to choose an appropriate `Session ID` 120 // and `User Id`. They can be a random number or some type of user and session 121 // identifiers (preferably hashed). The length of the `Session ID` and 122 // `User ID` must not exceed 36 characters. 123 // 124 // For more information, see the [API interactions 125 // guide](https://cloud.google.com/dialogflow/docs/api-overview). 126 // 127 // Note: Always use agent versions for production traffic. 128 // See [Versions and 129 // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). 130 string session = 1 [ 131 (google.api.field_behavior) = REQUIRED, 132 (google.api.resource_reference) = { 133 type: "dialogflow.googleapis.com/Session" 134 } 135 ]; 136 137 // The parameters of this query. 138 QueryParameters query_params = 2; 139 140 // Required. The input specification. It can be set to: 141 // 142 // 1. an audio config which instructs the speech recognizer how to process 143 // the speech audio, 144 // 145 // 2. a conversational query in the form of text, or 146 // 147 // 3. an event that specifies which intent to trigger. 148 QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; 149 150 // Instructs the speech synthesizer how to generate the output 151 // audio. If this field is not set and agent-level speech synthesizer is not 152 // configured, no output audio is generated. 153 OutputAudioConfig output_audio_config = 4; 154 155 // Mask for 156 // [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] 157 // indicating which settings in this request-level config should override 158 // speech synthesizer settings defined at agent-level. 159 // 160 // If unspecified or empty, 161 // [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] 162 // replaces the agent-level config in its entirety. 163 google.protobuf.FieldMask output_audio_config_mask = 7; 164 165 // The natural language speech audio to be processed. This field 166 // should be populated iff `query_input` is set to an input audio config. 167 // A single request can contain up to 1 minute of speech audio data. 168 bytes input_audio = 5; 169} 170 171// The message returned from the DetectIntent method. 172message DetectIntentResponse { 173 // The unique identifier of the response. It can be used to 174 // locate a response in the training example set or for reporting issues. 175 string response_id = 1; 176 177 // The selected results of the conversational query or event processing. 178 // See `alternative_query_results` for additional potential results. 179 QueryResult query_result = 2; 180 181 // Specifies the status of the webhook request. 182 google.rpc.Status webhook_status = 3; 183 184 // The audio data bytes encoded as specified in the request. 185 // Note: The output audio is generated based on the values of default platform 186 // text responses found in the `query_result.fulfillment_messages` field. If 187 // multiple default text responses exist, they will be concatenated when 188 // generating audio. If no default platform text responses exist, the 189 // generated audio content will be empty. 190 // 191 // In some scenarios, multiple output audio fields may be present in the 192 // response structure. In these cases, only the top-most-level audio output 193 // has content. 194 bytes output_audio = 4; 195 196 // The config used by the speech synthesizer to generate the output audio. 197 OutputAudioConfig output_audio_config = 6; 198} 199 200// Represents the parameters of the conversational query. 201message QueryParameters { 202 // The time zone of this conversational query from the 203 // [time zone database](https://www.iana.org/time-zones), e.g., 204 // America/New_York, Europe/Paris. If not provided, the time zone specified in 205 // agent settings is used. 206 string time_zone = 1; 207 208 // The geo location of this conversational query. 209 google.type.LatLng geo_location = 2; 210 211 // The collection of contexts to be activated before this query is 212 // executed. 213 repeated Context contexts = 3; 214 215 // Specifies whether to delete all contexts in the current session 216 // before the new ones are activated. 217 bool reset_contexts = 4; 218 219 // Additional session entity types to replace or extend developer 220 // entity types with. The entity synonyms apply to all languages and persist 221 // for the session of this query. 222 repeated SessionEntityType session_entity_types = 5; 223 224 // This field can be used to pass custom data to your webhook. 225 // Arbitrary JSON objects are supported. 226 // If supplied, the value is used to populate the 227 // `WebhookRequest.original_detect_intent_request.payload` 228 // field sent to your webhook. 229 google.protobuf.Struct payload = 6; 230 231 // Configures the type of sentiment analysis to perform. If not 232 // provided, sentiment analysis is not performed. 233 SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; 234 235 // This field can be used to pass HTTP headers for a webhook 236 // call. These headers will be sent to webhook along with the headers that 237 // have been configured through the Dialogflow web console. The headers 238 // defined within this field will overwrite the headers configured through the 239 // Dialogflow console if there is a conflict. Header names are 240 // case-insensitive. Google's specified headers are not allowed. Including: 241 // "Host", "Content-Length", "Connection", "From", "User-Agent", 242 // "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", 243 // etc. 244 map<string, string> webhook_headers = 14; 245 246 // The platform of the virtual agent response messages. 247 // 248 // If not empty, only emits messages from this platform in the response. 249 // Valid values are the enum names of 250 // [platform][google.cloud.dialogflow.v2.Intent.Message.platform]. 251 string platform = 18; 252} 253 254// Represents the query input. It can contain either: 255// 256// 1. An audio config which instructs the speech recognizer how to process the 257// speech audio. 258// 259// 2. A conversational query in the form of text. 260// 261// 3. An event that specifies which intent to trigger. 262message QueryInput { 263 // Required. The input specification. 264 oneof input { 265 // Instructs the speech recognizer how to process the speech audio. 266 InputAudioConfig audio_config = 1; 267 268 // The natural language text to be processed. Text length must not exceed 269 // 256 character for virtual agent interactions. 270 TextInput text = 2; 271 272 // The event to be processed. 273 EventInput event = 3; 274 } 275} 276 277// Represents the result of conversational query or event processing. 278message QueryResult { 279 // The original conversational query text: 280 // 281 // - If natural language text was provided as input, `query_text` contains 282 // a copy of the input. 283 // - If natural language speech audio was provided as input, `query_text` 284 // contains the speech recognition result. If speech recognizer produced 285 // multiple alternatives, a particular one is picked. 286 // - If automatic spell correction is enabled, `query_text` will contain the 287 // corrected user input. 288 string query_text = 1; 289 290 // The language that was triggered during intent detection. 291 // See [Language 292 // Support](https://cloud.google.com/dialogflow/docs/reference/language) 293 // for a list of the currently supported language codes. 294 string language_code = 15; 295 296 // The Speech recognition confidence between 0.0 and 1.0. A higher number 297 // indicates an estimated greater likelihood that the recognized words are 298 // correct. The default of 0.0 is a sentinel value indicating that confidence 299 // was not set. 300 // 301 // This field is not guaranteed to be accurate or set. In particular this 302 // field isn't set for StreamingDetectIntent since the streaming endpoint has 303 // separate confidence estimates per portion of the audio in 304 // StreamingRecognitionResult. 305 float speech_recognition_confidence = 2; 306 307 // The action name from the matched intent. 308 string action = 3; 309 310 // The collection of extracted parameters. 311 // 312 // Depending on your protocol or client library language, this is a 313 // map, associative array, symbol table, dictionary, or JSON object 314 // composed of a collection of (MapKey, MapValue) pairs: 315 // 316 // * MapKey type: string 317 // * MapKey value: parameter name 318 // * MapValue type: If parameter's entity type is a composite entity then use 319 // map, otherwise, depending on the parameter value type, it could be one of 320 // string, number, boolean, null, list or map. 321 // * MapValue value: If parameter's entity type is a composite entity then use 322 // map from composite entity property names to property values, otherwise, 323 // use parameter value. 324 google.protobuf.Struct parameters = 4; 325 326 // This field is set to: 327 // 328 // - `false` if the matched intent has required parameters and not all of 329 // the required parameter values have been collected. 330 // - `true` if all required parameter values have been collected, or if the 331 // matched intent doesn't contain any required parameters. 332 bool all_required_params_present = 5; 333 334 // Indicates whether the conversational query triggers a cancellation for slot 335 // filling. For more information, see the [cancel slot filling 336 // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). 337 bool cancels_slot_filling = 21; 338 339 // The text to be pronounced to the user or shown on the screen. 340 // Note: This is a legacy field, `fulfillment_messages` should be preferred. 341 string fulfillment_text = 6; 342 343 // The collection of rich messages to present to the user. 344 repeated Intent.Message fulfillment_messages = 7; 345 346 // If the query was fulfilled by a webhook call, this field is set to the 347 // value of the `source` field returned in the webhook response. 348 string webhook_source = 8; 349 350 // If the query was fulfilled by a webhook call, this field is set to the 351 // value of the `payload` field returned in the webhook response. 352 google.protobuf.Struct webhook_payload = 9; 353 354 // The collection of output contexts. If applicable, 355 // `output_contexts.parameters` contains entries with name 356 // `<parameter name>.original` containing the original parameter values 357 // before the query. 358 repeated Context output_contexts = 10; 359 360 // The intent that matched the conversational query. Some, not 361 // all fields are filled in this message, including but not limited to: 362 // `name`, `display_name`, `end_interaction` and `is_fallback`. 363 Intent intent = 11; 364 365 // The intent detection confidence. Values range from 0.0 366 // (completely uncertain) to 1.0 (completely certain). 367 // This value is for informational purpose only and is only used to 368 // help match the best intent within the classification threshold. 369 // This value may change for the same end-user expression at any time due to a 370 // model retraining or change in implementation. 371 // If there are `multiple knowledge_answers` messages, this value is set to 372 // the greatest `knowledgeAnswers.match_confidence` value in the list. 373 float intent_detection_confidence = 12; 374 375 // Free-form diagnostic information for the associated detect intent request. 376 // The fields of this data can change without notice, so you should not write 377 // code that depends on its structure. 378 // The data may contain: 379 // 380 // - webhook call latency 381 // - webhook errors 382 google.protobuf.Struct diagnostic_info = 14; 383 384 // The sentiment analysis result, which depends on the 385 // `sentiment_analysis_request_config` specified in the request. 386 SentimentAnalysisResult sentiment_analysis_result = 17; 387} 388 389// The top-level message sent by the client to the 390// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] 391// method. 392// 393// Multiple request messages should be sent in order: 394// 395// 1. The first message must contain 396// [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], 397// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] 398// plus optionally 399// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. 400// If the client wants to receive an audio response, it should also contain 401// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. 402// The message must not contain 403// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. 404// 2. If 405// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] 406// was set to 407// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], 408// all subsequent messages must contain 409// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] 410// to continue with Speech recognition. If you decide to rather detect an 411// intent from text input after you already started Speech recognition, 412// please send a message with 413// [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. 414// 415// However, note that: 416// 417// * Dialogflow will bill you for the audio duration so far. 418// * Dialogflow discards all Speech recognition results in favor of the 419// input text. 420// * Dialogflow will use the language code from the first message. 421// 422// After you sent all input, you must half-close or abort the request stream. 423message StreamingDetectIntentRequest { 424 // Required. The name of the session the query is sent to. 425 // Format of the session name: 426 // `projects/<Project ID>/agent/sessions/<Session ID>`, or 427 // `projects/<Project ID>/agent/environments/<Environment ID>/users/<User 428 // ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume 429 // default 'draft' environment. If `User ID` is not specified, we are using 430 // "-". It's up to the API caller to choose an appropriate `Session ID` and 431 // `User Id`. They can be a random number or some type of user and session 432 // identifiers (preferably hashed). The length of the `Session ID` and 433 // `User ID` must not exceed 36 characters. 434 // 435 // For more information, see the [API interactions 436 // guide](https://cloud.google.com/dialogflow/docs/api-overview). 437 // 438 // Note: Always use agent versions for production traffic. 439 // See [Versions and 440 // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). 441 string session = 1 [ 442 (google.api.field_behavior) = REQUIRED, 443 (google.api.resource_reference) = { 444 type: "dialogflow.googleapis.com/Session" 445 } 446 ]; 447 448 // The parameters of this query. 449 QueryParameters query_params = 2; 450 451 // Required. The input specification. It can be set to: 452 // 453 // 1. an audio config which instructs the speech recognizer how to process 454 // the speech audio, 455 // 456 // 2. a conversational query in the form of text, or 457 // 458 // 3. an event that specifies which intent to trigger. 459 QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; 460 461 // Please use 462 // [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] 463 // instead. If `false` (default), recognition does not cease until the client 464 // closes the stream. If `true`, the recognizer will detect a single spoken 465 // utterance in input audio. Recognition ceases when it detects the audio's 466 // voice has stopped or paused. In this case, once a detected intent is 467 // received, the client should close the stream and start a new request with a 468 // new stream as needed. This setting is ignored when `query_input` is a piece 469 // of text or an event. 470 bool single_utterance = 4 [deprecated = true]; 471 472 // Instructs the speech synthesizer how to generate the output 473 // audio. If this field is not set and agent-level speech synthesizer is not 474 // configured, no output audio is generated. 475 OutputAudioConfig output_audio_config = 5; 476 477 // Mask for 478 // [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] 479 // indicating which settings in this request-level config should override 480 // speech synthesizer settings defined at agent-level. 481 // 482 // If unspecified or empty, 483 // [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] 484 // replaces the agent-level config in its entirety. 485 google.protobuf.FieldMask output_audio_config_mask = 7; 486 487 // The input audio content to be recognized. Must be sent if 488 // `query_input` was set to a streaming input audio config. The complete audio 489 // over all streaming messages must not exceed 1 minute. 490 bytes input_audio = 6; 491 492 // if true, `StreamingDetectIntentResponse.debugging_info` will get populated. 493 bool enable_debugging_info = 8; 494} 495 496// Cloud conversation info for easier debugging. 497// It will get populated in `StreamingDetectIntentResponse` or 498// `StreamingAnalyzeContentResponse` when the flag `enable_debugging_info` is 499// set to true in corresponding requests. 500message CloudConversationDebuggingInfo { 501 // Number of input audio data chunks in streaming requests. 502 int32 audio_data_chunks = 1; 503 504 // Time offset of the end of speech utterance relative to the 505 // beginning of the first audio chunk. 506 google.protobuf.Duration result_end_time_offset = 2; 507 508 // Duration of first audio chunk. 509 google.protobuf.Duration first_audio_duration = 3; 510 511 // Whether client used single utterance mode. 512 bool single_utterance = 5; 513 514 // Time offsets of the speech partial results relative to the beginning of 515 // the stream. 516 repeated google.protobuf.Duration speech_partial_results_end_times = 6; 517 518 // Time offsets of the speech final results (is_final=true) relative to the 519 // beginning of the stream. 520 repeated google.protobuf.Duration speech_final_results_end_times = 7; 521 522 // Total number of partial responses. 523 int32 partial_responses = 8; 524 525 // Time offset of Speaker ID stream close time relative to the Speech stream 526 // close time in milliseconds. Only meaningful for conversations involving 527 // passive verification. 528 int32 speaker_id_passive_latency_ms_offset = 9; 529 530 // Whether a barge-in event is triggered in this request. 531 bool bargein_event_triggered = 10; 532 533 // Whether speech uses single utterance mode. 534 bool speech_single_utterance = 11; 535 536 // Time offsets of the DTMF partial results relative to the beginning of 537 // the stream. 538 repeated google.protobuf.Duration dtmf_partial_results_times = 12; 539 540 // Time offsets of the DTMF final results relative to the beginning of 541 // the stream. 542 repeated google.protobuf.Duration dtmf_final_results_times = 13; 543 544 // Time offset of the end-of-single-utterance signal relative to the 545 // beginning of the stream. 546 google.protobuf.Duration single_utterance_end_time_offset = 14; 547 548 // No speech timeout settings for the stream. 549 google.protobuf.Duration no_speech_timeout = 15; 550 551 // Speech endpointing timeout settings for the stream. 552 google.protobuf.Duration endpointing_timeout = 19; 553 554 // Whether the streaming terminates with an injected text query. 555 bool is_input_text = 16; 556 557 // Client half close time in terms of input audio duration. 558 google.protobuf.Duration client_half_close_time_offset = 17; 559 560 // Client half close time in terms of API streaming duration. 561 google.protobuf.Duration client_half_close_streaming_time_offset = 18; 562} 563 564// The top-level message returned from the 565// `StreamingDetectIntent` method. 566// 567// Multiple response messages can be returned in order: 568// 569// 1. If the `StreamingDetectIntentRequest.input_audio` field was 570// set, the `recognition_result` field is populated for one 571// or more messages. 572// See the 573// [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] 574// message for details about the result message sequence. 575// 576// 2. The next message contains `response_id`, `query_result` 577// and optionally `webhook_status` if a WebHook was called. 578message StreamingDetectIntentResponse { 579 // The unique identifier of the response. It can be used to 580 // locate a response in the training example set or for reporting issues. 581 string response_id = 1; 582 583 // The result of speech recognition. 584 StreamingRecognitionResult recognition_result = 2; 585 586 // The result of the conversational query or event processing. 587 QueryResult query_result = 3; 588 589 // Specifies the status of the webhook request. 590 google.rpc.Status webhook_status = 4; 591 592 // The audio data bytes encoded as specified in the request. 593 // Note: The output audio is generated based on the values of default platform 594 // text responses found in the `query_result.fulfillment_messages` field. If 595 // multiple default text responses exist, they will be concatenated when 596 // generating audio. If no default platform text responses exist, the 597 // generated audio content will be empty. 598 // 599 // In some scenarios, multiple output audio fields may be present in the 600 // response structure. In these cases, only the top-most-level audio output 601 // has content. 602 bytes output_audio = 5; 603 604 // The config used by the speech synthesizer to generate the output audio. 605 OutputAudioConfig output_audio_config = 6; 606 607 // Debugging info that would get populated when 608 // `StreamingDetectIntentRequest.enable_debugging_info` is set to true. 609 CloudConversationDebuggingInfo debugging_info = 8; 610} 611 612// Contains a speech recognition result corresponding to a portion of the audio 613// that is currently being processed or an indication that this is the end 614// of the single requested utterance. 615// 616// While end-user audio is being processed, Dialogflow sends a series of 617// results. Each result may contain a `transcript` value. A transcript 618// represents a portion of the utterance. While the recognizer is processing 619// audio, transcript values may be interim values or finalized values. 620// Once a transcript is finalized, the `is_final` value is set to true and 621// processing continues for the next transcript. 622// 623// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` 624// was true, and the recognizer has completed processing audio, 625// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the 626// following (last) result contains the last finalized transcript. 627// 628// The complete end-user utterance is determined by concatenating the 629// finalized transcript values received for the series of results. 630// 631// In the following example, single utterance is enabled. In the case where 632// single utterance is not enabled, result 7 would not occur. 633// 634// ``` 635// Num | transcript | message_type | is_final 636// --- | ----------------------- | ----------------------- | -------- 637// 1 | "tube" | TRANSCRIPT | false 638// 2 | "to be a" | TRANSCRIPT | false 639// 3 | "to be" | TRANSCRIPT | false 640// 4 | "to be or not to be" | TRANSCRIPT | true 641// 5 | "that's" | TRANSCRIPT | false 642// 6 | "that is | TRANSCRIPT | false 643// 7 | unset | END_OF_SINGLE_UTTERANCE | unset 644// 8 | " that is the question" | TRANSCRIPT | true 645// ``` 646// 647// Concatenating the finalized transcripts with `is_final` set to true, 648// the complete utterance becomes "to be or not to be that is the question". 649message StreamingRecognitionResult { 650 // Type of the response message. 651 enum MessageType { 652 // Not specified. Should never be used. 653 MESSAGE_TYPE_UNSPECIFIED = 0; 654 655 // Message contains a (possibly partial) transcript. 656 TRANSCRIPT = 1; 657 658 // This event indicates that the server has detected the end of the user's 659 // speech utterance and expects no additional inputs. 660 // Therefore, the server will not process additional audio (although it may 661 // subsequently return additional results). The client should stop sending 662 // additional audio data, half-close the gRPC connection, and wait for any 663 // additional results until the server closes the gRPC connection. This 664 // message is only sent if `single_utterance` was set to `true`, and is not 665 // used otherwise. 666 END_OF_SINGLE_UTTERANCE = 2; 667 } 668 669 // Type of the result message. 670 MessageType message_type = 1; 671 672 // Transcript text representing the words that the user spoke. 673 // Populated if and only if `message_type` = `TRANSCRIPT`. 674 string transcript = 2; 675 676 // If `false`, the `StreamingRecognitionResult` represents an 677 // interim result that may change. If `true`, the recognizer will not return 678 // any further hypotheses about this piece of the audio. May only be populated 679 // for `message_type` = `TRANSCRIPT`. 680 bool is_final = 3; 681 682 // The Speech confidence between 0.0 and 1.0 for the current portion of audio. 683 // A higher number indicates an estimated greater likelihood that the 684 // recognized words are correct. The default of 0.0 is a sentinel value 685 // indicating that confidence was not set. 686 // 687 // This field is typically only provided if `is_final` is true and you should 688 // not rely on it being accurate or even set. 689 float confidence = 4; 690 691 // Word-specific information for the words recognized by Speech in 692 // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. 693 // Populated if and only if `message_type` = `TRANSCRIPT` and 694 // [InputAudioConfig.enable_word_info] is set. 695 repeated SpeechWordInfo speech_word_info = 7; 696 697 // Time offset of the end of this Speech recognition result relative to the 698 // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. 699 google.protobuf.Duration speech_end_offset = 8; 700 701 // Detected language code for the transcript. 702 string language_code = 10; 703} 704 705// Auxiliary proto messages. 706// 707// Represents the natural language text to be processed. 708message TextInput { 709 // Required. The UTF-8 encoded natural language text to be processed. 710 // Text length must not exceed 256 characters for virtual agent interactions. 711 string text = 1 [(google.api.field_behavior) = REQUIRED]; 712 713 // Required. The language of this conversational query. See [Language 714 // Support](https://cloud.google.com/dialogflow/docs/reference/language) 715 // for a list of the currently supported language codes. Note that queries in 716 // the same session do not necessarily need to specify the same language. 717 string language_code = 2 [(google.api.field_behavior) = REQUIRED]; 718} 719 720// Events allow for matching intents by event name instead of the natural 721// language input. For instance, input `<event: { name: "welcome_event", 722// parameters: { name: "Sam" } }>` can trigger a personalized welcome response. 723// The parameter `name` may be used by the agent in the response: 724// `"Hello #welcome_event.name! What can I do for you today?"`. 725message EventInput { 726 // Required. The unique identifier of the event. 727 string name = 1 [(google.api.field_behavior) = REQUIRED]; 728 729 // The collection of parameters associated with the event. 730 // 731 // Depending on your protocol or client library language, this is a 732 // map, associative array, symbol table, dictionary, or JSON object 733 // composed of a collection of (MapKey, MapValue) pairs: 734 // 735 // * MapKey type: string 736 // * MapKey value: parameter name 737 // * MapValue type: If parameter's entity type is a composite entity then use 738 // map, otherwise, depending on the parameter value type, it could be one of 739 // string, number, boolean, null, list or map. 740 // * MapValue value: If parameter's entity type is a composite entity then use 741 // map from composite entity property names to property values, otherwise, 742 // use parameter value. 743 google.protobuf.Struct parameters = 2; 744 745 // Required. The language of this query. See [Language 746 // Support](https://cloud.google.com/dialogflow/docs/reference/language) 747 // for a list of the currently supported language codes. Note that queries in 748 // the same session do not necessarily need to specify the same language. 749 // 750 // This field is ignored when used in the context of a 751 // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2.WebhookResponse.followup_event_input] 752 // field, because the language was already defined in the originating detect 753 // intent request. 754 string language_code = 3 [(google.api.field_behavior) = REQUIRED]; 755} 756 757// Configures the types of sentiment analysis to perform. 758message SentimentAnalysisRequestConfig { 759 // Instructs the service to perform sentiment analysis on 760 // `query_text`. If not provided, sentiment analysis is not performed on 761 // `query_text`. 762 bool analyze_query_text_sentiment = 1; 763} 764 765// The result of sentiment analysis. Sentiment analysis inspects user input 766// and identifies the prevailing subjective opinion, especially to determine a 767// user's attitude as positive, negative, or neutral. 768// For [Participants.DetectIntent][], it needs to be configured in 769// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. 770// For [Participants.StreamingDetectIntent][], it needs to be configured in 771// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. 772// And for 773// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] 774// and 775// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], 776// it needs to be configured in 777// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] 778message SentimentAnalysisResult { 779 // The sentiment analysis result for `query_text`. 780 Sentiment query_text_sentiment = 1; 781} 782 783// The sentiment, such as positive/negative feeling or association, for a unit 784// of analysis, such as the query text. See: 785// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values 786// for how to interpret the result. 787message Sentiment { 788 // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive 789 // sentiment). 790 float score = 1; 791 792 // A non-negative number in the [0, +inf) range, which represents the absolute 793 // magnitude of sentiment, regardless of score (positive or negative). 794 float magnitude = 2; 795} 796