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.cx.v3; 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/cx/v3/audio_config.proto"; 24import "google/cloud/dialogflow/cx/v3/intent.proto"; 25import "google/cloud/dialogflow/cx/v3/page.proto"; 26import "google/cloud/dialogflow/cx/v3/response_message.proto"; 27import "google/cloud/dialogflow/cx/v3/session_entity_type.proto"; 28import "google/protobuf/duration.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.Cx.V3"; 35option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb"; 36option java_multiple_files = true; 37option java_outer_classname = "SessionProto"; 38option java_package = "com.google.cloud.dialogflow.cx.v3"; 39option objc_class_prefix = "DF"; 40option ruby_package = "Google::Cloud::Dialogflow::CX::V3"; 41option (google.api.resource_definition) = { 42 type: "dialogflow.googleapis.com/Session" 43 pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}" 44 pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}" 45}; 46 47// A session represents an interaction with a user. You retrieve user input 48// and pass it to the 49// [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to 50// determine user intent and respond. 51service Sessions { 52 option (google.api.default_host) = "dialogflow.googleapis.com"; 53 option (google.api.oauth_scopes) = 54 "https://www.googleapis.com/auth/cloud-platform," 55 "https://www.googleapis.com/auth/dialogflow"; 56 57 // Processes a natural language query and returns structured, actionable data 58 // as a result. This method is not idempotent, because it may cause session 59 // entity types to be updated, which in turn might affect results of future 60 // queries. 61 // 62 // Note: Always use agent versions for production traffic. 63 // See [Versions and 64 // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). 65 rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { 66 option (google.api.http) = { 67 post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent" 68 body: "*" 69 additional_bindings { 70 post: "/v3/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent" 71 body: "*" 72 } 73 }; 74 } 75 76 // Processes a natural language query in audio format in a streaming fashion 77 // and returns structured, actionable data as a result. This method is only 78 // available via the gRPC API (not REST). 79 // 80 // Note: Always use agent versions for production traffic. 81 // See [Versions and 82 // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). 83 rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) 84 returns (stream StreamingDetectIntentResponse) {} 85 86 // Returns preliminary intent match results, doesn't change the session 87 // status. 88 rpc MatchIntent(MatchIntentRequest) returns (MatchIntentResponse) { 89 option (google.api.http) = { 90 post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent" 91 body: "*" 92 additional_bindings { 93 post: "/v3/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent" 94 body: "*" 95 } 96 }; 97 } 98 99 // Fulfills a matched intent returned by 100 // [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be 101 // called after 102 // [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent], with 103 // input from 104 // [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. 105 // Otherwise, the behavior is undefined. 106 rpc FulfillIntent(FulfillIntentRequest) returns (FulfillIntentResponse) { 107 option (google.api.http) = { 108 post: "/v3/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent" 109 body: "*" 110 additional_bindings { 111 post: "/v3/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent" 112 body: "*" 113 } 114 }; 115 } 116} 117 118// The request to detect user's intent. 119message DetectIntentRequest { 120 // Required. The name of the session this query is sent to. 121 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 122 // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location 123 // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`. 124 // If `Environment ID` is not specified, we assume default 'draft' 125 // environment. 126 // It's up to the API caller to choose an appropriate `Session ID`. It can be 127 // a random number or some type of session identifiers (preferably hashed). 128 // The length of the `Session ID` must not exceed 36 characters. 129 // 130 // For more information, see the [sessions 131 // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). 132 // 133 // Note: Always use agent versions for production traffic. 134 // See [Versions and 135 // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). 136 string session = 1 [ 137 (google.api.field_behavior) = REQUIRED, 138 (google.api.resource_reference) = { 139 type: "dialogflow.googleapis.com/Session" 140 } 141 ]; 142 143 // The parameters of this query. 144 QueryParameters query_params = 2; 145 146 // Required. The input specification. 147 QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; 148 149 // Instructs the speech synthesizer how to generate the output audio. 150 OutputAudioConfig output_audio_config = 4; 151} 152 153// The message returned from the DetectIntent method. 154message DetectIntentResponse { 155 // Represents different DetectIntentResponse types. 156 enum ResponseType { 157 // Not specified. This should never happen. 158 RESPONSE_TYPE_UNSPECIFIED = 0; 159 160 // Partial response. e.g. Aggregated responses in a Fulfillment that enables 161 // `return_partial_response` can be returned as partial response. 162 // WARNING: partial response is not eligible for barge-in. 163 PARTIAL = 1; 164 165 // Final response. 166 FINAL = 2; 167 } 168 169 // Output only. The unique identifier of the response. It can be used to 170 // locate a response in the training example set or for reporting issues. 171 string response_id = 1; 172 173 // The result of the conversational query. 174 QueryResult query_result = 2; 175 176 // The audio data bytes encoded as specified in the request. 177 // Note: The output audio is generated based on the values of default platform 178 // text responses found in the 179 // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_messages] 180 // field. If multiple default text responses exist, they will be concatenated 181 // when generating audio. If no default platform text responses exist, the 182 // generated audio content will be empty. 183 // 184 // In some scenarios, multiple output audio fields may be present in the 185 // response structure. In these cases, only the top-most-level audio output 186 // has content. 187 bytes output_audio = 4; 188 189 // The config used by the speech synthesizer to generate the output audio. 190 OutputAudioConfig output_audio_config = 5; 191 192 // Response type. 193 ResponseType response_type = 6; 194 195 // Indicates whether the partial response can be cancelled when a later 196 // response arrives. e.g. if the agent specified some music as partial 197 // response, it can be cancelled. 198 bool allow_cancellation = 7; 199} 200 201// The top-level message sent by the client to the 202// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent] 203// method. 204// 205// Multiple request messages should be sent in order: 206// 207// 1. The first message must contain 208// [session][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.session], 209// [query_input][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_input] 210// plus optionally 211// [query_params][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_params]. 212// If the client wants to receive an audio response, it should also contain 213// [output_audio_config][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.output_audio_config]. 214// 215// 2. If 216// [query_input][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_input] 217// was set to 218// [query_input.audio.config][google.cloud.dialogflow.cx.v3.AudioInput.config], 219// all subsequent messages must contain 220// [query_input.audio.audio][google.cloud.dialogflow.cx.v3.AudioInput.audio] 221// to continue with Speech recognition. If you decide to rather detect an 222// intent from text input after you already started Speech recognition, 223// please send a message with 224// [query_input.text][google.cloud.dialogflow.cx.v3.QueryInput.text]. 225// 226// However, note that: 227// 228// * Dialogflow will bill you for the audio duration so far. 229// * Dialogflow discards all Speech recognition results in favor of the 230// input text. 231// * Dialogflow will use the language code from the first message. 232// 233// After you sent all input, you must half-close or abort the request stream. 234message StreamingDetectIntentRequest { 235 // The name of the session this query is sent to. 236 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 237 // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location 238 // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`. 239 // If `Environment ID` is not specified, we assume default 'draft' 240 // environment. 241 // It's up to the API caller to choose an appropriate `Session ID`. It can be 242 // a random number or some type of session identifiers (preferably hashed). 243 // The length of the `Session ID` must not exceed 36 characters. 244 // Note: session must be set in the first request. 245 // 246 // For more information, see the [sessions 247 // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). 248 // 249 // Note: Always use agent versions for production traffic. 250 // See [Versions and 251 // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). 252 string session = 1 [(google.api.resource_reference) = { 253 type: "dialogflow.googleapis.com/Session" 254 }]; 255 256 // The parameters of this query. 257 QueryParameters query_params = 2; 258 259 // Required. The input specification. 260 QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; 261 262 // Instructs the speech synthesizer how to generate the output audio. 263 OutputAudioConfig output_audio_config = 4; 264 265 // Enable partial detect intent response. If this flag is not enabled, 266 // response stream still contains only one final `DetectIntentResponse` even 267 // if some `Fulfillment`s in the agent have been configured to return partial 268 // responses. 269 bool enable_partial_response = 5; 270 271 // If true, `StreamingDetectIntentResponse.debugging_info` will get populated. 272 bool enable_debugging_info = 8; 273} 274 275// Cloud conversation info for easier debugging. 276// It will get populated in `StreamingDetectIntentResponse` or 277// `StreamingAnalyzeContentResponse` when the flag `enable_debugging_info` is 278// set to true in corresponding requests. 279message CloudConversationDebuggingInfo { 280 // Number of input audio data chunks in streaming requests. 281 int32 audio_data_chunks = 1; 282 283 // Time offset of the end of speech utterance relative to the 284 // beginning of the first audio chunk. 285 google.protobuf.Duration result_end_time_offset = 2; 286 287 // Duration of first audio chunk. 288 google.protobuf.Duration first_audio_duration = 3; 289 290 // Whether client used single utterance mode. 291 bool single_utterance = 5; 292 293 // Time offsets of the speech partial results relative to the beginning of 294 // the stream. 295 repeated google.protobuf.Duration speech_partial_results_end_times = 6; 296 297 // Time offsets of the speech final results (is_final=true) relative to the 298 // beginning of the stream. 299 repeated google.protobuf.Duration speech_final_results_end_times = 7; 300 301 // Total number of partial responses. 302 int32 partial_responses = 8; 303 304 // Time offset of Speaker ID stream close time relative to the Speech stream 305 // close time in milliseconds. Only meaningful for conversations involving 306 // passive verification. 307 int32 speaker_id_passive_latency_ms_offset = 9; 308 309 // Whether a barge-in event is triggered in this request. 310 bool bargein_event_triggered = 10; 311 312 // Whether speech uses single utterance mode. 313 bool speech_single_utterance = 11; 314 315 // Time offsets of the DTMF partial results relative to the beginning of 316 // the stream. 317 repeated google.protobuf.Duration dtmf_partial_results_times = 12; 318 319 // Time offsets of the DTMF final results relative to the beginning of 320 // the stream. 321 repeated google.protobuf.Duration dtmf_final_results_times = 13; 322 323 // Time offset of the end-of-single-utterance signal relative to the 324 // beginning of the stream. 325 google.protobuf.Duration single_utterance_end_time_offset = 14; 326 327 // No speech timeout settings observed at runtime. 328 google.protobuf.Duration no_speech_timeout = 15; 329 330 // Whether the streaming terminates with an injected text query. 331 bool is_input_text = 16; 332 333 // Client half close time in terms of input audio duration. 334 google.protobuf.Duration client_half_close_time_offset = 17; 335 336 // Client half close time in terms of API streaming duration. 337 google.protobuf.Duration client_half_close_streaming_time_offset = 18; 338} 339 340// The top-level message returned from the 341// [StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent] 342// method. 343// 344// Multiple response messages (N) can be returned in order. 345// 346// The first (N-1) responses set either the `recognition_result` or 347// `detect_intent_response` field, depending on the request: 348// 349// * If the `StreamingDetectIntentRequest.query_input.audio` field was 350// set, and the `StreamingDetectIntentRequest.enable_partial_response` 351// field was false, the `recognition_result` field is populated for each 352// of the (N-1) responses. 353// See the 354// [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.StreamingRecognitionResult] 355// message for details about the result message sequence. 356// 357// * If the `StreamingDetectIntentRequest.enable_partial_response` field was 358// true, the `detect_intent_response` field is populated for each 359// of the (N-1) responses, where 1 <= N <= 4. 360// These responses set the 361// [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type] 362// field to `PARTIAL`. 363// 364// For the final Nth response message, the `detect_intent_response` is fully 365// populated, and 366// [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type] 367// is set to `FINAL`. 368message StreamingDetectIntentResponse { 369 // The output response. 370 oneof response { 371 // The result of speech recognition. 372 StreamingRecognitionResult recognition_result = 1; 373 374 // The response from detect intent. 375 DetectIntentResponse detect_intent_response = 2; 376 } 377 378 // Debugging info that would get populated when 379 // `StreamingDetectIntentRequest.enable_debugging_info` is set to true. 380 CloudConversationDebuggingInfo debugging_info = 4; 381} 382 383// Contains a speech recognition result corresponding to a portion of the audio 384// that is currently being processed or an indication that this is the end 385// of the single requested utterance. 386// 387// While end-user audio is being processed, Dialogflow sends a series of 388// results. Each result may contain a `transcript` value. A transcript 389// represents a portion of the utterance. While the recognizer is processing 390// audio, transcript values may be interim values or finalized values. 391// Once a transcript is finalized, the `is_final` value is set to true and 392// processing continues for the next transcript. 393// 394// If `StreamingDetectIntentRequest.query_input.audio.config.single_utterance` 395// was true, and the recognizer has completed processing audio, 396// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the 397// following (last) result contains the last finalized transcript. 398// 399// The complete end-user utterance is determined by concatenating the 400// finalized transcript values received for the series of results. 401// 402// In the following example, single utterance is enabled. In the case where 403// single utterance is not enabled, result 7 would not occur. 404// 405// ``` 406// Num | transcript | message_type | is_final 407// --- | ----------------------- | ----------------------- | -------- 408// 1 | "tube" | TRANSCRIPT | false 409// 2 | "to be a" | TRANSCRIPT | false 410// 3 | "to be" | TRANSCRIPT | false 411// 4 | "to be or not to be" | TRANSCRIPT | true 412// 5 | "that's" | TRANSCRIPT | false 413// 6 | "that is | TRANSCRIPT | false 414// 7 | unset | END_OF_SINGLE_UTTERANCE | unset 415// 8 | " that is the question" | TRANSCRIPT | true 416// ``` 417// 418// Concatenating the finalized transcripts with `is_final` set to true, 419// the complete utterance becomes "to be or not to be that is the question". 420message StreamingRecognitionResult { 421 // Type of the response message. 422 enum MessageType { 423 // Not specified. Should never be used. 424 MESSAGE_TYPE_UNSPECIFIED = 0; 425 426 // Message contains a (possibly partial) transcript. 427 TRANSCRIPT = 1; 428 429 // Event indicates that the server has detected the end of the user's speech 430 // utterance and expects no additional speech. Therefore, the server will 431 // not process additional audio (although it may subsequently return 432 // additional results). The client should stop sending additional audio 433 // data, half-close the gRPC connection, and wait for any additional results 434 // until the server closes the gRPC connection. This message is only sent if 435 // [`single_utterance`][google.cloud.dialogflow.cx.v3.InputAudioConfig.single_utterance] 436 // was set to `true`, and is not used otherwise. 437 END_OF_SINGLE_UTTERANCE = 2; 438 } 439 440 // Type of the result message. 441 MessageType message_type = 1; 442 443 // Transcript text representing the words that the user spoke. 444 // Populated if and only if `message_type` = `TRANSCRIPT`. 445 string transcript = 2; 446 447 // If `false`, the `StreamingRecognitionResult` represents an 448 // interim result that may change. If `true`, the recognizer will not return 449 // any further hypotheses about this piece of the audio. May only be populated 450 // for `message_type` = `TRANSCRIPT`. 451 bool is_final = 3; 452 453 // The Speech confidence between 0.0 and 1.0 for the current portion of audio. 454 // A higher number indicates an estimated greater likelihood that the 455 // recognized words are correct. The default of 0.0 is a sentinel value 456 // indicating that confidence was not set. 457 // 458 // This field is typically only provided if `is_final` is true and you should 459 // not rely on it being accurate or even set. 460 float confidence = 4; 461 462 // An estimate of the likelihood that the speech recognizer will 463 // not change its guess about this interim recognition result: 464 // * If the value is unspecified or 0.0, Dialogflow didn't compute the 465 // stability. In particular, Dialogflow will only provide stability for 466 // `TRANSCRIPT` results with `is_final = false`. 467 // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely 468 // unstable and 1.0 means completely stable. 469 float stability = 6; 470 471 // Word-specific information for the words recognized by Speech in 472 // [transcript][google.cloud.dialogflow.cx.v3.StreamingRecognitionResult.transcript]. 473 // Populated if and only if `message_type` = `TRANSCRIPT` and 474 // [InputAudioConfig.enable_word_info] is set. 475 repeated SpeechWordInfo speech_word_info = 7; 476 477 // Time offset of the end of this Speech recognition result relative to the 478 // beginning of the audio. Only populated for `message_type` = 479 // `TRANSCRIPT`. 480 google.protobuf.Duration speech_end_offset = 8; 481 482 // Detected language code for the transcript. 483 string language_code = 10; 484} 485 486// Represents the parameters of a conversational query. 487message QueryParameters { 488 // The time zone of this conversational query from the [time zone 489 // database](https://www.iana.org/time-zones), e.g., America/New_York, 490 // Europe/Paris. If not provided, the time zone specified in the agent is 491 // used. 492 string time_zone = 1; 493 494 // The geo location of this conversational query. 495 google.type.LatLng geo_location = 2; 496 497 // Additional session entity types to replace or extend developer entity types 498 // with. The entity synonyms apply to all languages and persist for the 499 // session of this query. 500 repeated SessionEntityType session_entity_types = 3; 501 502 // This field can be used to pass custom data into the webhook associated with 503 // the agent. Arbitrary JSON objects are supported. 504 // Some integrations that query a Dialogflow agent may provide additional 505 // information in the payload. 506 // In particular, for the Dialogflow Phone Gateway integration, this field has 507 // the form: 508 // ``` 509 // { 510 // "telephony": { 511 // "caller_id": "+18558363987" 512 // } 513 // } 514 // ``` 515 google.protobuf.Struct payload = 4; 516 517 // Additional parameters to be put into [session 518 // parameters][SessionInfo.parameters]. To remove a 519 // parameter from the session, clients should explicitly set the parameter 520 // value to null. 521 // 522 // You can reference the session parameters in the agent with the following 523 // format: $session.params.parameter-id. 524 // 525 // Depending on your protocol or client library language, this is a 526 // map, associative array, symbol table, dictionary, or JSON object 527 // composed of a collection of (MapKey, MapValue) pairs: 528 // 529 // * MapKey type: string 530 // * MapKey value: parameter name 531 // * MapValue type: If parameter's entity type is a composite entity then use 532 // map, otherwise, depending on the parameter value type, it could be one of 533 // string, number, boolean, null, list or map. 534 // * MapValue value: If parameter's entity type is a composite entity then use 535 // map from composite entity property names to property values, otherwise, 536 // use parameter value. 537 google.protobuf.Struct parameters = 5; 538 539 // The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to 540 // override the [current page][QueryResult.current_page] in the session. 541 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 542 // ID>/flows/<Flow ID>/pages/<Page ID>`. 543 // 544 // If `current_page` is specified, the previous state of the session will be 545 // ignored by Dialogflow, including the [previous 546 // page][QueryResult.current_page] and the [previous session 547 // parameters][QueryResult.parameters]. 548 // In most cases, 549 // [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page] 550 // and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters] 551 // should be configured together to direct a session to a specific state. 552 string current_page = 6 [ 553 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Page" } 554 ]; 555 556 // Whether to disable webhook calls for this request. 557 bool disable_webhook = 7; 558 559 // Configures whether sentiment analysis should be performed. If not 560 // provided, sentiment analysis is not performed. 561 bool analyze_query_text_sentiment = 8; 562 563 // This field can be used to pass HTTP headers for a webhook 564 // call. These headers will be sent to webhook along with the headers that 565 // have been configured through Dialogflow web console. The headers defined 566 // within this field will overwrite the headers configured through Dialogflow 567 // console if there is a conflict. Header names are case-insensitive. 568 // Google's specified headers are not allowed. Including: "Host", 569 // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", 570 // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc. 571 map<string, string> webhook_headers = 10; 572 573 // A list of flow versions to override for the request. 574 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 575 // ID>/flows/<Flow ID>/versions/<Version ID>`. 576 // 577 // If version 1 of flow X is included in this list, the traffic of 578 // flow X will go through version 1 regardless of the version configuration in 579 // the environment. Each flow can have at most one version specified in this 580 // list. 581 repeated string flow_versions = 14 [(google.api.resource_reference) = { 582 type: "dialogflow.googleapis.com/Version" 583 }]; 584 585 // The channel which this query is for. 586 // 587 // If specified, only the 588 // [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated 589 // with the channel will be returned. If no 590 // [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is 591 // associated with the channel, it falls back to the 592 // [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with 593 // unspecified channel. 594 // 595 // If unspecified, the 596 // [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with 597 // unspecified channel will be returned. 598 string channel = 15; 599} 600 601// Represents the query input. It can contain one of: 602// 603// 1. A conversational query in the form of text. 604// 605// 2. An intent query that specifies which intent to trigger. 606// 607// 3. Natural language speech audio to be processed. 608// 609// 4. An event to be triggered. 610// 611// 5. DTMF digits to invoke an intent and fill in parameter value. 612message QueryInput { 613 // Required. The input specification. 614 oneof input { 615 // The natural language text to be processed. 616 TextInput text = 2; 617 618 // The intent to be triggered. 619 IntentInput intent = 3; 620 621 // The natural language speech audio to be processed. 622 AudioInput audio = 5; 623 624 // The event to be triggered. 625 EventInput event = 6; 626 627 // The DTMF event to be handled. 628 DtmfInput dtmf = 7; 629 } 630 631 // Required. The language of the input. See [Language 632 // Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) 633 // for a list of the currently supported language codes. Note that queries in 634 // the same session do not necessarily need to specify the same language. 635 string language_code = 4 [(google.api.field_behavior) = REQUIRED]; 636} 637 638// Represents the result of a conversational query. 639message QueryResult { 640 // The original conversational query. 641 oneof query { 642 // If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was 643 // provided as input, this field will contain a copy of the text. 644 string text = 1; 645 646 // If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as 647 // input, this field will contain a copy of the intent identifier. Format: 648 // `projects/<Project ID>/locations/<Location ID>/agents/<Agent 649 // ID>/intents/<Intent ID>`. 650 string trigger_intent = 11 [(google.api.resource_reference) = { 651 type: "dialogflow.googleapis.com/Intent" 652 }]; 653 654 // If [natural language speech 655 // audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, 656 // this field will contain the transcript for the audio. 657 string transcript = 12; 658 659 // If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as 660 // input, this field will contain the name of the event. 661 string trigger_event = 14; 662 663 // If a [DTMF][google.cloud.dialogflow.cx.v3.DtmfInput] was provided as 664 // input, this field will contain a copy of the 665 // [DtmfInput][google.cloud.dialogflow.cx.v3.DtmfInput]. 666 DtmfInput dtmf = 23; 667 } 668 669 // The language that was triggered during intent detection. 670 // See [Language 671 // Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) 672 // for a list of the currently supported language codes. 673 string language_code = 2; 674 675 // The collected [session 676 // parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters]. 677 // 678 // Depending on your protocol or client library language, this is a 679 // map, associative array, symbol table, dictionary, or JSON object 680 // composed of a collection of (MapKey, MapValue) pairs: 681 // 682 // * MapKey type: string 683 // * MapKey value: parameter name 684 // * MapValue type: If parameter's entity type is a composite entity then use 685 // map, otherwise, depending on the parameter value type, it could be one of 686 // string, number, boolean, null, list or map. 687 // * MapValue value: If parameter's entity type is a composite entity then use 688 // map from composite entity property names to property values, otherwise, 689 // use parameter value. 690 google.protobuf.Struct parameters = 3; 691 692 // The list of rich messages returned to the client. Responses vary from 693 // simple text messages to more sophisticated, structured payloads used 694 // to drive complex logic. 695 repeated ResponseMessage response_messages = 4; 696 697 // The list of webhook call status in the order of call sequence. 698 repeated google.rpc.Status webhook_statuses = 13; 699 700 // The list of webhook payload in 701 // [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload], 702 // in the order of call sequence. If some webhook call fails or doesn't return 703 // any payload, an empty `Struct` would be used instead. 704 repeated google.protobuf.Struct webhook_payloads = 6; 705 706 // The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all 707 // fields are filled in this message, including but not limited to `name` and 708 // `display_name`. 709 Page current_page = 7; 710 711 // The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the 712 // conversational query. Some, not all fields are filled in this message, 713 // including but not limited to: `name` and `display_name`. This field is 714 // deprecated, please use 715 // [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] 716 // instead. 717 Intent intent = 8 [deprecated = true]; 718 719 // The intent detection confidence. Values range from 0.0 (completely 720 // uncertain) to 1.0 (completely certain). 721 // This value is for informational purpose only and is only used to 722 // help match the best intent within the classification threshold. 723 // This value may change for the same end-user expression at any time due to a 724 // model retraining or change in implementation. 725 // This field is deprecated, please use 726 // [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] 727 // instead. 728 float intent_detection_confidence = 9 [deprecated = true]; 729 730 // Intent match result, could be an intent or an event. 731 Match match = 15; 732 733 // The free-form diagnostic info. For example, this field could contain 734 // webhook call latency. The fields of this data can change without notice, 735 // so you should not write code that depends on its structure. 736 // 737 // One of the fields is called "Alternative Matched Intents", which may 738 // aid with debugging. The following describes these intent results: 739 // 740 // - The list is empty if no intent was matched to end-user input. 741 // - Only intents that are referenced in the currently active flow are 742 // included. 743 // - The matched intent is included. 744 // - Other intents that could have matched end-user input, but did not match 745 // because they are referenced by intent routes that are out of 746 // [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), 747 // are included. 748 // - Other intents referenced by intent routes in scope that matched end-user 749 // input, but had a lower confidence score. 750 google.protobuf.Struct diagnostic_info = 10; 751 752 // The sentiment analyss result, which depends on 753 // [`analyze_query_text_sentiment`] 754 // [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment], 755 // specified in the request. 756 SentimentAnalysisResult sentiment_analysis_result = 17; 757} 758 759// Represents the natural language text to be processed. 760message TextInput { 761 // Required. The UTF-8 encoded natural language text to be processed. Text 762 // length must not exceed 256 characters. 763 string text = 1 [(google.api.field_behavior) = REQUIRED]; 764} 765 766// Represents the intent to trigger programmatically rather than as a result of 767// natural language processing. 768message IntentInput { 769 // Required. The unique identifier of the intent. 770 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 771 // ID>/intents/<Intent ID>`. 772 string intent = 1 [ 773 (google.api.field_behavior) = REQUIRED, 774 (google.api.resource_reference) = { 775 type: "dialogflow.googleapis.com/Intent" 776 } 777 ]; 778} 779 780// Represents the natural speech audio to be processed. 781message AudioInput { 782 // Required. Instructs the speech recognizer how to process the speech audio. 783 InputAudioConfig config = 1 [(google.api.field_behavior) = REQUIRED]; 784 785 // The natural language speech audio to be processed. 786 // A single request can contain up to 2 minutes of speech audio data. 787 // The [transcribed 788 // text][google.cloud.dialogflow.cx.v3.QueryResult.transcript] cannot contain 789 // more than 256 bytes. 790 // 791 // For non-streaming audio detect intent, both `config` and `audio` must be 792 // provided. 793 // For streaming audio detect intent, `config` must be provided in 794 // the first request and `audio` must be provided in all following requests. 795 bytes audio = 2; 796} 797 798// Represents the event to trigger. 799message EventInput { 800 // Name of the event. 801 string event = 1; 802} 803 804// Represents the input for dtmf event. 805message DtmfInput { 806 // The dtmf digits. 807 string digits = 1; 808 809 // The finish digit (if any). 810 string finish_digit = 2; 811} 812 813// Represents one match result of [MatchIntent][]. 814message Match { 815 // Type of a Match. 816 enum MatchType { 817 // Not specified. Should never be used. 818 MATCH_TYPE_UNSPECIFIED = 0; 819 820 // The query was matched to an intent. 821 INTENT = 1; 822 823 // The query directly triggered an intent. 824 DIRECT_INTENT = 2; 825 826 // The query was used for parameter filling. 827 PARAMETER_FILLING = 3; 828 829 // No match was found for the query. 830 NO_MATCH = 4; 831 832 // Indicates an empty query. 833 NO_INPUT = 5; 834 835 // The query directly triggered an event. 836 EVENT = 6; 837 } 838 839 // The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the query. 840 // Some, not all fields are filled in this message, including but not limited 841 // to: `name` and `display_name`. Only filled for 842 // [`INTENT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match type. 843 Intent intent = 1; 844 845 // The event that matched the query. Filled for 846 // [`EVENT`][google.cloud.dialogflow.cx.v3.Match.MatchType], 847 // [`NO_MATCH`][google.cloud.dialogflow.cx.v3.Match.MatchType] and 848 // [`NO_INPUT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. 849 string event = 6; 850 851 // The collection of parameters extracted from the query. 852 // 853 // Depending on your protocol or client library language, this is a 854 // map, associative array, symbol table, dictionary, or JSON object 855 // composed of a collection of (MapKey, MapValue) pairs: 856 // 857 // * MapKey type: string 858 // * MapKey value: parameter name 859 // * MapValue type: If parameter's entity type is a composite entity then use 860 // map, otherwise, depending on the parameter value type, it could be one of 861 // string, number, boolean, null, list or map. 862 // * MapValue value: If parameter's entity type is a composite entity then use 863 // map from composite entity property names to property values, otherwise, 864 // use parameter value. 865 google.protobuf.Struct parameters = 2; 866 867 // Final text input which was matched during MatchIntent. This value can be 868 // different from original input sent in request because of spelling 869 // correction or other processing. 870 string resolved_input = 3; 871 872 // Type of this [Match][google.cloud.dialogflow.cx.v3.Match]. 873 MatchType match_type = 4; 874 875 // The confidence of this match. Values range from 0.0 (completely uncertain) 876 // to 1.0 (completely certain). 877 // This value is for informational purpose only and is only used to help match 878 // the best intent within the classification threshold. This value may change 879 // for the same end-user expression at any time due to a model retraining or 880 // change in implementation. 881 float confidence = 5; 882} 883 884// Request of [MatchIntent][]. 885message MatchIntentRequest { 886 // Required. The name of the session this query is sent to. 887 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 888 // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location 889 // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`. 890 // If `Environment ID` is not specified, we assume default 'draft' 891 // environment. 892 // It's up to the API caller to choose an appropriate `Session ID`. It can be 893 // a random number or some type of session identifiers (preferably hashed). 894 // The length of the `Session ID` must not exceed 36 characters. 895 // 896 // For more information, see the [sessions 897 // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). 898 string session = 1 [ 899 (google.api.field_behavior) = REQUIRED, 900 (google.api.resource_reference) = { 901 type: "dialogflow.googleapis.com/Session" 902 } 903 ]; 904 905 // The parameters of this query. 906 QueryParameters query_params = 2; 907 908 // Required. The input specification. 909 QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; 910 911 // Persist session parameter changes from `query_params`. 912 bool persist_parameter_changes = 5; 913} 914 915// Response of [MatchIntent][]. 916message MatchIntentResponse { 917 // The original conversational query. 918 oneof query { 919 // If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was 920 // provided as input, this field will contain a copy of the text. 921 string text = 1; 922 923 // If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as 924 // input, this field will contain a copy of the intent identifier. Format: 925 // `projects/<Project ID>/locations/<Location ID>/agents/<Agent 926 // ID>/intents/<Intent ID>`. 927 string trigger_intent = 2 [(google.api.resource_reference) = { 928 type: "dialogflow.googleapis.com/Intent" 929 }]; 930 931 // If [natural language speech 932 // audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, 933 // this field will contain the transcript for the audio. 934 string transcript = 3; 935 936 // If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as 937 // input, this field will contain a copy of the event name. 938 string trigger_event = 6; 939 } 940 941 // Match results, if more than one, ordered descendingly by the confidence 942 // we have that the particular intent matches the query. 943 repeated Match matches = 4; 944 945 // The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all 946 // fields are filled in this message, including but not limited to `name` and 947 // `display_name`. 948 Page current_page = 5; 949} 950 951// Request of [FulfillIntent][] 952message FulfillIntentRequest { 953 // Must be same as the corresponding MatchIntent request, otherwise the 954 // behavior is undefined. 955 MatchIntentRequest match_intent_request = 1; 956 957 // The matched intent/event to fulfill. 958 Match match = 2; 959 960 // Instructs the speech synthesizer how to generate output audio. 961 OutputAudioConfig output_audio_config = 3; 962} 963 964// Response of [FulfillIntent][] 965message FulfillIntentResponse { 966 // Output only. The unique identifier of the response. It can be used to 967 // locate a response in the training example set or for reporting issues. 968 string response_id = 1; 969 970 // The result of the conversational query. 971 QueryResult query_result = 2; 972 973 // The audio data bytes encoded as specified in the request. 974 // Note: The output audio is generated based on the values of default platform 975 // text responses found in the 976 // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_messages] 977 // field. If multiple default text responses exist, they will be concatenated 978 // when generating audio. If no default platform text responses exist, the 979 // generated audio content will be empty. 980 // 981 // In some scenarios, multiple output audio fields may be present in the 982 // response structure. In these cases, only the top-most-level audio output 983 // has content. 984 bytes output_audio = 3; 985 986 // The config used by the speech synthesizer to generate the output audio. 987 OutputAudioConfig output_audio_config = 4; 988} 989 990// The result of sentiment analysis. Sentiment analysis inspects user input 991// and identifies the prevailing subjective opinion, especially to determine a 992// user's attitude as positive, negative, or neutral. 993message SentimentAnalysisResult { 994 // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive 995 // sentiment). 996 float score = 1; 997 998 // A non-negative number in the [0, +inf) range, which represents the absolute 999 // magnitude of sentiment, regardless of score (positive or negative). 1000 float magnitude = 2; 1001} 1002