xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3/response_message.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/field_behavior.proto";
20import "google/protobuf/struct.proto";
21
22option cc_enable_arenas = true;
23option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3";
24option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb";
25option java_multiple_files = true;
26option java_outer_classname = "ResponseMessageProto";
27option java_package = "com.google.cloud.dialogflow.cx.v3";
28option objc_class_prefix = "DF";
29option ruby_package = "Google::Cloud::Dialogflow::CX::V3";
30
31// Represents a response message that can be returned by a conversational agent.
32//
33// Response messages are also used for output audio synthesis. The approach is
34// as follows:
35//
36// * If at least one OutputAudioText response is present, then all
37//   OutputAudioText responses are linearly concatenated, and the result is used
38//   for output audio synthesis.
39// * If the OutputAudioText responses are a mixture of text and SSML, then the
40//   concatenated result is treated as SSML; otherwise, the result is treated as
41//   either text or SSML as appropriate. The agent designer should ideally use
42//   either text or SSML consistently throughout the bot design.
43// * Otherwise, all Text responses are linearly concatenated, and the result is
44//   used for output audio synthesis.
45//
46// This approach allows for more sophisticated user experience scenarios, where
47// the text displayed to the user may differ from what is heard.
48message ResponseMessage {
49  // The text response message.
50  message Text {
51    // Required. A collection of text responses.
52    repeated string text = 1 [(google.api.field_behavior) = REQUIRED];
53
54    // Output only. Whether the playback of this message can be interrupted by
55    // the end user's speech and the client can then starts the next Dialogflow
56    // request.
57    bool allow_playback_interruption = 2
58        [(google.api.field_behavior) = OUTPUT_ONLY];
59  }
60
61  // Indicates that the conversation should be handed off to a live agent.
62  //
63  // Dialogflow only uses this to determine which conversations were handed off
64  // to a human agent for measurement purposes. What else to do with this signal
65  // is up to you and your handoff procedures.
66  //
67  // You may set this, for example:
68  // * In the
69  // [entry_fulfillment][google.cloud.dialogflow.cx.v3.Page.entry_fulfillment]
70  // of a [Page][google.cloud.dialogflow.cx.v3.Page] if
71  //   entering the page indicates something went extremely wrong in the
72  //   conversation.
73  // * In a webhook response when you determine that the customer issue can only
74  //   be handled by a human.
75  message LiveAgentHandoff {
76    // Custom metadata for your handoff procedure. Dialogflow doesn't impose
77    // any structure on this.
78    google.protobuf.Struct metadata = 1;
79  }
80
81  // Indicates that the conversation succeeded, i.e., the bot handled the issue
82  // that the customer talked to it about.
83  //
84  // Dialogflow only uses this to determine which conversations should be
85  // counted as successful and doesn't process the metadata in this message in
86  // any way. Note that Dialogflow also considers conversations that get to the
87  // conversation end page as successful even if they don't return
88  // [ConversationSuccess][google.cloud.dialogflow.cx.v3.ResponseMessage.ConversationSuccess].
89  //
90  // You may set this, for example:
91  // * In the
92  // [entry_fulfillment][google.cloud.dialogflow.cx.v3.Page.entry_fulfillment]
93  // of a [Page][google.cloud.dialogflow.cx.v3.Page] if
94  //   entering the page indicates that the conversation succeeded.
95  // * In a webhook response when you determine that you handled the customer
96  //   issue.
97  message ConversationSuccess {
98    // Custom metadata. Dialogflow doesn't impose any structure on this.
99    google.protobuf.Struct metadata = 1;
100  }
101
102  // A text or ssml response that is preferentially used for TTS output audio
103  // synthesis, as described in the comment on the ResponseMessage message.
104  message OutputAudioText {
105    // The source, which is either plain text or SSML.
106    oneof source {
107      // The raw text to be synthesized.
108      string text = 1;
109
110      // The SSML text to be synthesized. For more information, see
111      // [SSML](/speech/text-to-speech/docs/ssml).
112      string ssml = 2;
113    }
114
115    // Output only. Whether the playback of this message can be interrupted by
116    // the end user's speech and the client can then starts the next Dialogflow
117    // request.
118    bool allow_playback_interruption = 3
119        [(google.api.field_behavior) = OUTPUT_ONLY];
120  }
121
122  // Indicates that interaction with the Dialogflow agent has ended.
123  // This message is generated by Dialogflow only and not supposed to be
124  // defined by the user.
125  message EndInteraction {}
126
127  // Specifies an audio clip to be played by the client as part of the response.
128  message PlayAudio {
129    // Required. URI of the audio clip. Dialogflow does not impose any
130    // validation on this value. It is specific to the client that reads it.
131    string audio_uri = 1 [(google.api.field_behavior) = REQUIRED];
132
133    // Output only. Whether the playback of this message can be interrupted by
134    // the end user's speech and the client can then starts the next Dialogflow
135    // request.
136    bool allow_playback_interruption = 2
137        [(google.api.field_behavior) = OUTPUT_ONLY];
138  }
139
140  // Represents an audio message that is composed of both segments
141  // synthesized from the Dialogflow agent prompts and ones hosted externally
142  // at the specified URIs.
143  // The external URIs are specified via
144  // [play_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.play_audio].
145  // This message is generated by Dialogflow only and not supposed to be
146  // defined by the user.
147  message MixedAudio {
148    // Represents one segment of audio.
149    message Segment {
150      // Content of the segment.
151      oneof content {
152        // Raw audio synthesized from the Dialogflow agent's response using
153        // the output config specified in the request.
154        bytes audio = 1;
155
156        // Client-specific URI that points to an audio clip accessible to the
157        // client. Dialogflow does not impose any validation on it.
158        string uri = 2;
159      }
160
161      // Output only. Whether the playback of this segment can be interrupted by
162      // the end user's speech and the client should then start the next
163      // Dialogflow request.
164      bool allow_playback_interruption = 3
165          [(google.api.field_behavior) = OUTPUT_ONLY];
166    }
167
168    // Segments this audio response is composed of.
169    repeated Segment segments = 1;
170  }
171
172  // Represents the signal that telles the client to transfer the phone call
173  // connected to the agent to a third-party endpoint.
174  message TelephonyTransferCall {
175    // Endpoint to transfer the call to.
176    oneof endpoint {
177      // Transfer the call to a phone number
178      // in [E.164 format](https://en.wikipedia.org/wiki/E.164).
179      string phone_number = 1;
180    }
181  }
182
183  // Represents info card response. If the response contains generative
184  // knowledge prediction, Dialogflow will return a payload with Infobot
185  // Messenger compatible info card.
186  //
187  // Otherwise, the info card response is skipped.
188  message KnowledgeInfoCard {}
189
190  // Represents different response types.
191  enum ResponseType {
192    // Not specified.
193    RESPONSE_TYPE_UNSPECIFIED = 0;
194
195    // The response is from an [entry
196    // prompt][google.cloud.dialogflow.cx.v3.Page.entry_fulfillment] in the
197    // page.
198    ENTRY_PROMPT = 1;
199
200    // The response is from [form-filling
201    // prompt][google.cloud.dialogflow.cx.v3.Form.Parameter.fill_behavior] in
202    // the page.
203    PARAMETER_PROMPT = 2;
204
205    // The response is from a [transition
206    // route][google.cloud.dialogflow.cx.v3.TransitionRoute] or an [event
207    // handler][EventHandler] in the page or flow or transition route group.
208    HANDLER_PROMPT = 3;
209  }
210
211  // Required. The rich response message.
212  oneof message {
213    // Returns a text response.
214    Text text = 1;
215
216    // Returns a response containing a custom, platform-specific payload.
217    google.protobuf.Struct payload = 2;
218
219    // Indicates that the conversation succeeded.
220    ConversationSuccess conversation_success = 9;
221
222    // A text or ssml response that is preferentially used for TTS output audio
223    // synthesis, as described in the comment on the ResponseMessage message.
224    OutputAudioText output_audio_text = 8;
225
226    // Hands off conversation to a human agent.
227    LiveAgentHandoff live_agent_handoff = 10;
228
229    // Output only. A signal that indicates the interaction with the Dialogflow
230    // agent has ended. This message is generated by Dialogflow only when the
231    // conversation reaches `END_SESSION` page. It is not supposed to be defined
232    // by the user.
233    //
234    // It's guaranteed that there is at most one such message in each response.
235    EndInteraction end_interaction = 11
236        [(google.api.field_behavior) = OUTPUT_ONLY];
237
238    // Signal that the client should play an audio clip hosted at a
239    // client-specific URI. Dialogflow uses this to construct
240    // [mixed_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.mixed_audio].
241    // However, Dialogflow itself does not try to read or process the URI in any
242    // way.
243    PlayAudio play_audio = 12;
244
245    // Output only. An audio response message composed of both the synthesized
246    // Dialogflow agent responses and responses defined via
247    // [play_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.play_audio].
248    // This message is generated by Dialogflow only and not supposed to be
249    // defined by the user.
250    MixedAudio mixed_audio = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
251
252    // A signal that the client should transfer the phone call connected to
253    // this agent to a third-party endpoint.
254    TelephonyTransferCall telephony_transfer_call = 18;
255
256    // Represents info card for knowledge answers, to be better rendered in
257    // Dialogflow Messenger.
258    KnowledgeInfoCard knowledge_info_card = 20;
259  }
260
261  // Response type.
262  ResponseType response_type = 4;
263
264  // The channel which the response is associated with. Clients can specify the
265  // channel via
266  // [QueryParameters.channel][google.cloud.dialogflow.cx.v3.QueryParameters.channel],
267  // and only associated channel response will be returned.
268  string channel = 19;
269}
270