response_message.proto 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.cloud.dialogflow.cx.v3beta1;
  16. import "google/api/field_behavior.proto";
  17. import "google/protobuf/struct.proto";
  18. option cc_enable_arenas = true;
  19. option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "ResponseMessageProto";
  23. option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
  24. option objc_class_prefix = "DF";
  25. option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
  26. // Represents a response message that can be returned by a conversational agent.
  27. //
  28. // Response messages are also used for output audio synthesis. The approach is
  29. // as follows:
  30. //
  31. // * If at least one OutputAudioText response is present, then all
  32. // OutputAudioText responses are linearly concatenated, and the result is used
  33. // for output audio synthesis.
  34. // * If the OutputAudioText responses are a mixture of text and SSML, then the
  35. // concatenated result is treated as SSML; otherwise, the result is treated as
  36. // either text or SSML as appropriate. The agent designer should ideally use
  37. // either text or SSML consistently throughout the bot design.
  38. // * Otherwise, all Text responses are linearly concatenated, and the result is
  39. // used for output audio synthesis.
  40. //
  41. // This approach allows for more sophisticated user experience scenarios, where
  42. // the text displayed to the user may differ from what is heard.
  43. message ResponseMessage {
  44. // The text response message.
  45. message Text {
  46. // Required. A collection of text responses.
  47. repeated string text = 1 [(google.api.field_behavior) = REQUIRED];
  48. // Output only. Whether the playback of this message can be interrupted by the end
  49. // user's speech and the client can then starts the next Dialogflow
  50. // request.
  51. bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  52. }
  53. // Indicates that the conversation should be handed off to a live agent.
  54. //
  55. // Dialogflow only uses this to determine which conversations were handed off
  56. // to a human agent for measurement purposes. What else to do with this signal
  57. // is up to you and your handoff procedures.
  58. //
  59. // You may set this, for example:
  60. // * In the [entry_fulfillment][google.cloud.dialogflow.cx.v3beta1.Page.entry_fulfillment] of a [Page][google.cloud.dialogflow.cx.v3beta1.Page] if
  61. // entering the page indicates something went extremely wrong in the
  62. // conversation.
  63. // * In a webhook response when you determine that the customer issue can only
  64. // be handled by a human.
  65. message LiveAgentHandoff {
  66. // Custom metadata for your handoff procedure. Dialogflow doesn't impose
  67. // any structure on this.
  68. google.protobuf.Struct metadata = 1;
  69. }
  70. // Indicates that the conversation succeeded, i.e., the bot handled the issue
  71. // that the customer talked to it about.
  72. //
  73. // Dialogflow only uses this to determine which conversations should be
  74. // counted as successful and doesn't process the metadata in this message in
  75. // any way. Note that Dialogflow also considers conversations that get to the
  76. // conversation end page as successful even if they don't return
  77. // [ConversationSuccess][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess].
  78. //
  79. // You may set this, for example:
  80. // * In the [entry_fulfillment][google.cloud.dialogflow.cx.v3beta1.Page.entry_fulfillment] of a [Page][google.cloud.dialogflow.cx.v3beta1.Page] if
  81. // entering the page indicates that the conversation succeeded.
  82. // * In a webhook response when you determine that you handled the customer
  83. // issue.
  84. message ConversationSuccess {
  85. // Custom metadata. Dialogflow doesn't impose any structure on this.
  86. google.protobuf.Struct metadata = 1;
  87. }
  88. // A text or ssml response that is preferentially used for TTS output audio
  89. // synthesis, as described in the comment on the ResponseMessage message.
  90. message OutputAudioText {
  91. // The source, which is either plain text or SSML.
  92. oneof source {
  93. // The raw text to be synthesized.
  94. string text = 1;
  95. // The SSML text to be synthesized. For more information, see
  96. // [SSML](/speech/text-to-speech/docs/ssml).
  97. string ssml = 2;
  98. }
  99. // Output only. Whether the playback of this message can be interrupted by the end
  100. // user's speech and the client can then starts the next Dialogflow
  101. // request.
  102. bool allow_playback_interruption = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  103. }
  104. // Indicates that interaction with the Dialogflow agent has ended.
  105. // This message is generated by Dialogflow only and not supposed to be
  106. // defined by the user.
  107. message EndInteraction {
  108. }
  109. // Specifies an audio clip to be played by the client as part of the response.
  110. message PlayAudio {
  111. // Required. URI of the audio clip. Dialogflow does not impose any validation on this
  112. // value. It is specific to the client that reads it.
  113. string audio_uri = 1 [(google.api.field_behavior) = REQUIRED];
  114. // Output only. Whether the playback of this message can be interrupted by the end
  115. // user's speech and the client can then starts the next Dialogflow
  116. // request.
  117. bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  118. }
  119. // Represents an audio message that is composed of both segments
  120. // synthesized from the Dialogflow agent prompts and ones hosted externally
  121. // at the specified URIs.
  122. // The external URIs are specified via
  123. // [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
  124. // This message is generated by Dialogflow only and not supposed to be
  125. // defined by the user.
  126. message MixedAudio {
  127. // Represents one segment of audio.
  128. message Segment {
  129. // Content of the segment.
  130. oneof content {
  131. // Raw audio synthesized from the Dialogflow agent's response using
  132. // the output config specified in the request.
  133. bytes audio = 1;
  134. // Client-specific URI that points to an audio clip accessible to the
  135. // client. Dialogflow does not impose any validation on it.
  136. string uri = 2;
  137. }
  138. // Output only. Whether the playback of this segment can be interrupted by the end
  139. // user's speech and the client should then start the next Dialogflow
  140. // request.
  141. bool allow_playback_interruption = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  142. }
  143. // Segments this audio response is composed of.
  144. repeated Segment segments = 1;
  145. }
  146. // Represents the signal that telles the client to transfer the phone call
  147. // connected to the agent to a third-party endpoint.
  148. message TelephonyTransferCall {
  149. // Endpoint to transfer the call to.
  150. oneof endpoint {
  151. // Transfer the call to a phone number
  152. // in [E.164 format](https://en.wikipedia.org/wiki/E.164).
  153. string phone_number = 1;
  154. }
  155. }
  156. // Required. The rich response message.
  157. oneof message {
  158. // Returns a text response.
  159. Text text = 1;
  160. // Returns a response containing a custom, platform-specific payload.
  161. google.protobuf.Struct payload = 2;
  162. // Indicates that the conversation succeeded.
  163. ConversationSuccess conversation_success = 9;
  164. // A text or ssml response that is preferentially used for TTS output audio
  165. // synthesis, as described in the comment on the ResponseMessage message.
  166. OutputAudioText output_audio_text = 8;
  167. // Hands off conversation to a human agent.
  168. LiveAgentHandoff live_agent_handoff = 10;
  169. // Output only. A signal that indicates the interaction with the Dialogflow agent has
  170. // ended.
  171. // This message is generated by Dialogflow only when the conversation
  172. // reaches `END_SESSION` page. It is not supposed to be defined by the user.
  173. //
  174. // It's guaranteed that there is at most one such message in each response.
  175. EndInteraction end_interaction = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  176. // Signal that the client should play an audio clip hosted at a
  177. // client-specific URI. Dialogflow uses this to construct
  178. // [mixed_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.mixed_audio]. However, Dialogflow itself
  179. // does not try to read or process the URI in any way.
  180. PlayAudio play_audio = 12;
  181. // Output only. An audio response message composed of both the synthesized Dialogflow
  182. // agent responses and responses defined via
  183. // [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
  184. // This message is generated by Dialogflow only and not supposed to be
  185. // defined by the user.
  186. MixedAudio mixed_audio = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
  187. // A signal that the client should transfer the phone call connected to
  188. // this agent to a third-party endpoint.
  189. TelephonyTransferCall telephony_transfer_call = 18;
  190. }
  191. }