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/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/protobuf/duration.proto"; 22 23option cc_enable_arenas = true; 24option csharp_namespace = "Google.Cloud.Dialogflow.V2"; 25option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb"; 26option java_multiple_files = true; 27option java_outer_classname = "AudioConfigProto"; 28option java_package = "com.google.cloud.dialogflow.v2"; 29option objc_class_prefix = "DF"; 30option (google.api.resource_definition) = { 31 type: "automl.googleapis.com/Model" 32 pattern: "projects/{project}/locations/{location}/models/{model}" 33}; 34option (google.api.resource_definition) = { 35 type: "speech.googleapis.com/PhraseSet" 36 pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" 37}; 38 39// Hints for the speech recognizer to help with recognition in a specific 40// conversation state. 41message SpeechContext { 42 // Optional. A list of strings containing words and phrases that the speech 43 // recognizer should recognize with higher likelihood. 44 // 45 // This list can be used to: 46 // 47 // * improve accuracy for words and phrases you expect the user to say, 48 // e.g. typical commands for your Dialogflow agent 49 // * add additional words to the speech recognizer vocabulary 50 // * ... 51 // 52 // See the [Cloud Speech 53 // documentation](https://cloud.google.com/speech-to-text/quotas) for usage 54 // limits. 55 repeated string phrases = 1 [(google.api.field_behavior) = OPTIONAL]; 56 57 // Optional. Boost for this context compared to other contexts: 58 // 59 // * If the boost is positive, Dialogflow will increase the probability that 60 // the phrases in this context are recognized over similar sounding phrases. 61 // * If the boost is unspecified or non-positive, Dialogflow will not apply 62 // any boost. 63 // 64 // Dialogflow recommends that you use boosts in the range (0, 20] and that you 65 // find a value that fits your use case with binary search. 66 float boost = 2 [(google.api.field_behavior) = OPTIONAL]; 67} 68 69// Information for a word recognized by the speech recognizer. 70message SpeechWordInfo { 71 // The word this info is for. 72 string word = 3; 73 74 // Time offset relative to the beginning of the audio that corresponds to the 75 // start of the spoken word. This is an experimental feature and the accuracy 76 // of the time offset can vary. 77 google.protobuf.Duration start_offset = 1; 78 79 // Time offset relative to the beginning of the audio that corresponds to the 80 // end of the spoken word. This is an experimental feature and the accuracy of 81 // the time offset can vary. 82 google.protobuf.Duration end_offset = 2; 83 84 // The Speech confidence between 0.0 and 1.0 for this word. A higher number 85 // indicates an estimated greater likelihood that the recognized word is 86 // correct. The default of 0.0 is a sentinel value indicating that confidence 87 // was not set. 88 // 89 // This field is not guaranteed to be fully stable over time for the same 90 // audio input. Users should also not rely on it to always be provided. 91 float confidence = 4; 92} 93 94// Instructs the speech recognizer how to process the audio content. 95message InputAudioConfig { 96 // Required. Audio encoding of the audio content to process. 97 AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; 98 99 // Required. Sample rate (in Hertz) of the audio content sent in the query. 100 // Refer to [Cloud Speech API 101 // documentation](https://cloud.google.com/speech-to-text/docs/basics) for 102 // more details. 103 int32 sample_rate_hertz = 2 [(google.api.field_behavior) = REQUIRED]; 104 105 // Required. The language of the supplied audio. Dialogflow does not do 106 // translations. See [Language 107 // Support](https://cloud.google.com/dialogflow/docs/reference/language) 108 // for a list of the currently supported language codes. Note that queries in 109 // the same session do not necessarily need to specify the same language. 110 string language_code = 3 [(google.api.field_behavior) = REQUIRED]; 111 112 // If `true`, Dialogflow returns 113 // [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in 114 // [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] 115 // with information about the recognized speech words, e.g. start and end time 116 // offsets. If false or unspecified, Speech doesn't return any word-level 117 // information. 118 bool enable_word_info = 13; 119 120 // A list of strings containing words and phrases that the speech 121 // recognizer should recognize with higher likelihood. 122 // 123 // See [the Cloud Speech 124 // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) 125 // for more details. 126 // 127 // This field is deprecated. Please use [`speech_contexts`]() instead. If you 128 // specify both [`phrase_hints`]() and [`speech_contexts`](), Dialogflow will 129 // treat the [`phrase_hints`]() as a single additional [`SpeechContext`](). 130 repeated string phrase_hints = 4 [deprecated = true]; 131 132 // Context information to assist speech recognition. 133 // 134 // See [the Cloud Speech 135 // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) 136 // for more details. 137 repeated SpeechContext speech_contexts = 11; 138 139 // Optional. Which Speech model to select for the given request. 140 // For more information, see 141 // [Speech models](https://cloud.google.com/dialogflow/es/docs/speech-models). 142 string model = 7; 143 144 // Which variant of the [Speech 145 // model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. 146 SpeechModelVariant model_variant = 10; 147 148 // If `false` (default), recognition does not cease until the 149 // client closes the stream. 150 // If `true`, the recognizer will detect a single spoken utterance in input 151 // audio. Recognition ceases when it detects the audio's voice has 152 // stopped or paused. In this case, once a detected intent is received, the 153 // client should close the stream and start a new request with a new stream as 154 // needed. 155 // Note: This setting is relevant only for streaming methods. 156 // Note: When specified, InputAudioConfig.single_utterance takes precedence 157 // over StreamingDetectIntentRequest.single_utterance. 158 bool single_utterance = 8; 159 160 // Only used in 161 // [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] 162 // and 163 // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]. 164 // If `false` and recognition doesn't return any result, trigger 165 // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. 166 bool disable_no_speech_recognized_event = 14; 167 168 // Enable automatic punctuation option at the speech backend. 169 bool enable_automatic_punctuation = 17; 170 171 // If `true`, the request will opt out for STT conformer model migration. 172 // This field will be deprecated once force migration takes place in June 173 // 2024. Please refer to [Dialogflow ES Speech model 174 // migration](https://cloud.google.com/dialogflow/es/docs/speech-model-migration). 175 bool opt_out_conformer_model_migration = 26; 176} 177 178// Description of which voice to use for speech synthesis. 179message VoiceSelectionParams { 180 // Optional. The name of the voice. If not set, the service will choose a 181 // voice based on the other parameters such as language_code and 182 // [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]. 183 string name = 1 [(google.api.field_behavior) = OPTIONAL]; 184 185 // Optional. The preferred gender of the voice. If not set, the service will 186 // choose a voice based on the other parameters such as language_code and 187 // [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. Note that 188 // this is only a preference, not requirement. If a voice of the appropriate 189 // gender is not available, the synthesizer should substitute a voice with a 190 // different gender rather than failing the request. 191 SsmlVoiceGender ssml_gender = 2 [(google.api.field_behavior) = OPTIONAL]; 192} 193 194// Configuration of how speech should be synthesized. 195message SynthesizeSpeechConfig { 196 // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal 197 // native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 198 // is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any other 199 // values < 0.25 or > 4.0 will return an error. 200 double speaking_rate = 1 [(google.api.field_behavior) = OPTIONAL]; 201 202 // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 203 // semitones from the original pitch. -20 means decrease 20 semitones from the 204 // original pitch. 205 double pitch = 2 [(google.api.field_behavior) = OPTIONAL]; 206 207 // Optional. Volume gain (in dB) of the normal native volume supported by the 208 // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of 209 // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) 210 // will play at approximately half the amplitude of the normal native signal 211 // amplitude. A value of +6.0 (dB) will play at approximately twice the 212 // amplitude of the normal native signal amplitude. We strongly recommend not 213 // to exceed +10 (dB) as there's usually no effective increase in loudness for 214 // any value greater than that. 215 double volume_gain_db = 3 [(google.api.field_behavior) = OPTIONAL]; 216 217 // Optional. An identifier which selects 'audio effects' profiles that are 218 // applied on (post synthesized) text to speech. Effects are applied on top of 219 // each other in the order they are given. 220 repeated string effects_profile_id = 5 221 [(google.api.field_behavior) = OPTIONAL]; 222 223 // Optional. The desired voice of the synthesized audio. 224 VoiceSelectionParams voice = 4 [(google.api.field_behavior) = OPTIONAL]; 225} 226 227// Instructs the speech synthesizer on how to generate the output audio content. 228// If this audio config is supplied in a request, it overrides all existing 229// text-to-speech settings applied to the agent. 230message OutputAudioConfig { 231 // Required. Audio encoding of the synthesized audio content. 232 OutputAudioEncoding audio_encoding = 1 233 [(google.api.field_behavior) = REQUIRED]; 234 235 // The synthesis sample rate (in hertz) for this audio. If not 236 // provided, then the synthesizer will use the default sample rate based on 237 // the audio encoding. If this is different from the voice's natural sample 238 // rate, then the synthesizer will honor this request by converting to the 239 // desired sample rate (which might result in worse audio quality). 240 int32 sample_rate_hertz = 2; 241 242 // Configuration of how speech should be synthesized. 243 SynthesizeSpeechConfig synthesize_speech_config = 3; 244} 245 246// A wrapper of repeated TelephonyDtmf digits. 247message TelephonyDtmfEvents { 248 // A sequence of TelephonyDtmf digits. 249 repeated TelephonyDtmf dtmf_events = 1; 250} 251 252// Configures speech transcription for 253// [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. 254message SpeechToTextConfig { 255 // The speech model used in speech to text. 256 // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as 257 // `USE_ENHANCED`. It can be overridden in 258 // [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] 259 // and 260 // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] 261 // request. If enhanced model variant is specified and an enhanced version of 262 // the specified model for the language does not exist, then it would emit an 263 // error. 264 SpeechModelVariant speech_model_variant = 1; 265 266 // Which Speech model to select. Select the 267 // model best suited to your domain to get best results. If a model is not 268 // explicitly specified, then Dialogflow auto-selects a model based on other 269 // parameters in the SpeechToTextConfig and Agent settings. 270 // If enhanced speech model is enabled for the agent and an enhanced 271 // version of the specified model for the language does not exist, then the 272 // speech is recognized using the standard version of the specified model. 273 // Refer to 274 // [Cloud Speech API 275 // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) 276 // for more details. 277 // If you specify a model, the following models typically have the best 278 // performance: 279 // 280 // - phone_call (best for Agent Assist and telephony) 281 // - latest_short (best for Dialogflow non-telephony) 282 // - command_and_search 283 // 284 // Leave this field unspecified to use 285 // [Agent Speech 286 // settings](https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech) 287 // for model selection. 288 string model = 2; 289 290 // Use timeout based endpointing, interpreting endpointer sensitivy as 291 // seconds of timeout value. 292 bool use_timeout_based_endpointing = 11; 293} 294 295// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) 296// digit in Telephony Gateway. 297enum TelephonyDtmf { 298 // Not specified. This value may be used to indicate an absent digit. 299 TELEPHONY_DTMF_UNSPECIFIED = 0; 300 301 // Number: '1'. 302 DTMF_ONE = 1; 303 304 // Number: '2'. 305 DTMF_TWO = 2; 306 307 // Number: '3'. 308 DTMF_THREE = 3; 309 310 // Number: '4'. 311 DTMF_FOUR = 4; 312 313 // Number: '5'. 314 DTMF_FIVE = 5; 315 316 // Number: '6'. 317 DTMF_SIX = 6; 318 319 // Number: '7'. 320 DTMF_SEVEN = 7; 321 322 // Number: '8'. 323 DTMF_EIGHT = 8; 324 325 // Number: '9'. 326 DTMF_NINE = 9; 327 328 // Number: '0'. 329 DTMF_ZERO = 10; 330 331 // Letter: 'A'. 332 DTMF_A = 11; 333 334 // Letter: 'B'. 335 DTMF_B = 12; 336 337 // Letter: 'C'. 338 DTMF_C = 13; 339 340 // Letter: 'D'. 341 DTMF_D = 14; 342 343 // Asterisk/star: '*'. 344 DTMF_STAR = 15; 345 346 // Pound/diamond/hash/square/gate/octothorpe: '#'. 347 DTMF_POUND = 16; 348} 349 350// Audio encoding of the audio content sent in the conversational query request. 351// Refer to the 352// [Cloud Speech API 353// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more 354// details. 355enum AudioEncoding { 356 // Not specified. 357 AUDIO_ENCODING_UNSPECIFIED = 0; 358 359 // Uncompressed 16-bit signed little-endian samples (Linear PCM). 360 AUDIO_ENCODING_LINEAR_16 = 1; 361 362 // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio 363 // Codec) is the recommended encoding because it is lossless (therefore 364 // recognition is not compromised) and requires only about half the 365 // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and 366 // 24-bit samples, however, not all fields in `STREAMINFO` are supported. 367 AUDIO_ENCODING_FLAC = 2; 368 369 // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. 370 AUDIO_ENCODING_MULAW = 3; 371 372 // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. 373 AUDIO_ENCODING_AMR = 4; 374 375 // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. 376 AUDIO_ENCODING_AMR_WB = 5; 377 378 // Opus encoded audio frames in Ogg container 379 // ([OggOpus](https://wiki.xiph.org/OggOpus)). 380 // `sample_rate_hertz` must be 16000. 381 AUDIO_ENCODING_OGG_OPUS = 6; 382 383 // Although the use of lossy encodings is not recommended, if a very low 384 // bitrate encoding is required, `OGG_OPUS` is highly preferred over 385 // Speex encoding. The [Speex](https://speex.org/) encoding supported by 386 // Dialogflow API has a header byte in each block, as in MIME type 387 // `audio/x-speex-with-header-byte`. 388 // It is a variant of the RTP Speex encoding defined in 389 // [RFC 5574](https://tools.ietf.org/html/rfc5574). 390 // The stream is a sequence of blocks, one block per RTP packet. Each block 391 // starts with a byte containing the length of the block, in bytes, followed 392 // by one or more frames of Speex data, padded to an integral number of 393 // bytes (octets) as specified in RFC 5574. In other words, each RTP header 394 // is replaced with a single byte containing the block length. Only Speex 395 // wideband is supported. `sample_rate_hertz` must be 16000. 396 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; 397} 398 399// Variant of the specified [Speech 400// model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. 401// 402// See the [Cloud Speech 403// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 404// for which models have different variants. For example, the "phone_call" model 405// has both a standard and an enhanced variant. When you use an enhanced model, 406// you will generally receive higher quality results than for a standard model. 407enum SpeechModelVariant { 408 // No model variant specified. In this case Dialogflow defaults to 409 // USE_BEST_AVAILABLE. 410 SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; 411 412 // Use the best available variant of the [Speech 413 // model][InputAudioConfig.model] that the caller is eligible for. 414 // 415 // Please see the [Dialogflow 416 // docs](https://cloud.google.com/dialogflow/docs/data-logging) for 417 // how to make your project eligible for enhanced models. 418 USE_BEST_AVAILABLE = 1; 419 420 // Use standard model variant even if an enhanced model is available. See the 421 // [Cloud Speech 422 // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 423 // for details about enhanced models. 424 USE_STANDARD = 2; 425 426 // Use an enhanced model variant: 427 // 428 // * If an enhanced variant does not exist for the given 429 // [model][google.cloud.dialogflow.v2.InputAudioConfig.model] and request 430 // language, Dialogflow falls back to the standard variant. 431 // 432 // The [Cloud Speech 433 // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) 434 // describes which models have enhanced variants. 435 // 436 // * If the API caller isn't eligible for enhanced models, Dialogflow returns 437 // an error. Please see the [Dialogflow 438 // docs](https://cloud.google.com/dialogflow/docs/data-logging) 439 // for how to make your project eligible. 440 USE_ENHANCED = 3; 441} 442 443// Gender of the voice as described in 444// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). 445enum SsmlVoiceGender { 446 // An unspecified gender, which means that the client doesn't care which 447 // gender the selected voice will have. 448 SSML_VOICE_GENDER_UNSPECIFIED = 0; 449 450 // A male voice. 451 SSML_VOICE_GENDER_MALE = 1; 452 453 // A female voice. 454 SSML_VOICE_GENDER_FEMALE = 2; 455 456 // A gender-neutral voice. 457 SSML_VOICE_GENDER_NEUTRAL = 3; 458} 459 460// Audio encoding of the output audio format in Text-To-Speech. 461enum OutputAudioEncoding { 462 // Not specified. 463 OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; 464 465 // Uncompressed 16-bit signed little-endian samples (Linear PCM). 466 // Audio content returned as LINEAR16 also contains a WAV header. 467 OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; 468 469 // MP3 audio at 32kbps. 470 OUTPUT_AUDIO_ENCODING_MP3 = 2; 471 472 // MP3 audio at 64kbps. 473 OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; 474 475 // Opus encoded audio wrapped in an ogg container. The result will be a 476 // file which can be played natively on Android, and in browsers (at least 477 // Chrome and Firefox). The quality of the encoding is considerably higher 478 // than MP3 while using approximately the same bitrate. 479 OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; 480 481 // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. 482 OUTPUT_AUDIO_ENCODING_MULAW = 5; 483} 484