xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3beta1/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.v3beta1;
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.V3Beta1";
24option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb";
25option java_multiple_files = true;
26option java_outer_classname = "ResponseMessageProto";
27option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
28option objc_class_prefix = "DF";
29option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
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.v3beta1.Page.entry_fulfillment]
70  // of a [Page][google.cloud.dialogflow.cx.v3beta1.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.v3beta1.ResponseMessage.ConversationSuccess].
89  //
90  // You may set this, for example:
91  // * In the
92  // [entry_fulfillment][google.cloud.dialogflow.cx.v3beta1.Page.entry_fulfillment]
93  // of a [Page][google.cloud.dialogflow.cx.v3beta1.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.v3beta1.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  // Required. The rich response message.
191  oneof message {
192    // Returns a text response.
193    Text text = 1;
194
195    // Returns a response containing a custom, platform-specific payload.
196    google.protobuf.Struct payload = 2;
197
198    // Indicates that the conversation succeeded.
199    ConversationSuccess conversation_success = 9;
200
201    // A text or ssml response that is preferentially used for TTS output audio
202    // synthesis, as described in the comment on the ResponseMessage message.
203    OutputAudioText output_audio_text = 8;
204
205    // Hands off conversation to a human agent.
206    LiveAgentHandoff live_agent_handoff = 10;
207
208    // Output only. A signal that indicates the interaction with the Dialogflow
209    // agent has ended. This message is generated by Dialogflow only when the
210    // conversation reaches `END_SESSION` page. It is not supposed to be defined
211    // by the user.
212    //
213    // It's guaranteed that there is at most one such message in each response.
214    EndInteraction end_interaction = 11
215        [(google.api.field_behavior) = OUTPUT_ONLY];
216
217    // Signal that the client should play an audio clip hosted at a
218    // client-specific URI. Dialogflow uses this to construct
219    // [mixed_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.mixed_audio].
220    // However, Dialogflow itself does not try to read or process the URI in any
221    // way.
222    PlayAudio play_audio = 12;
223
224    // Output only. An audio response message composed of both the synthesized
225    // Dialogflow agent responses and responses defined via
226    // [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio].
227    // This message is generated by Dialogflow only and not supposed to be
228    // defined by the user.
229    MixedAudio mixed_audio = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
230
231    // A signal that the client should transfer the phone call connected to
232    // this agent to a third-party endpoint.
233    TelephonyTransferCall telephony_transfer_call = 18;
234
235    // Represents info card for knowledge answers, to be better rendered in
236    // Dialogflow Messenger.
237    KnowledgeInfoCard knowledge_info_card = 20;
238  }
239
240  // The channel which the response is associated with. Clients can specify the
241  // channel via
242  // [QueryParameters.channel][google.cloud.dialogflow.cx.v3beta1.QueryParameters.channel],
243  // and only associated channel response will be returned.
244  string channel = 19;
245}
246