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/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/dialogflow/v2/audio_config.proto";
24import "google/cloud/dialogflow/v2/session.proto";
25import "google/protobuf/field_mask.proto";
26import "google/protobuf/struct.proto";
27import "google/protobuf/timestamp.proto";
28import "google/rpc/status.proto";
29
30option cc_enable_arenas = true;
31option csharp_namespace = "Google.Cloud.Dialogflow.V2";
32option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
33option java_multiple_files = true;
34option java_outer_classname = "ParticipantProto";
35option java_package = "com.google.cloud.dialogflow.v2";
36option objc_class_prefix = "DF";
37
38// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
39service Participants {
40  option (google.api.default_host) = "dialogflow.googleapis.com";
41  option (google.api.oauth_scopes) =
42      "https://www.googleapis.com/auth/cloud-platform,"
43      "https://www.googleapis.com/auth/dialogflow";
44
45  // Creates a new participant in a conversation.
46  rpc CreateParticipant(CreateParticipantRequest) returns (Participant) {
47    option (google.api.http) = {
48      post: "/v2/{parent=projects/*/conversations/*}/participants"
49      body: "participant"
50      additional_bindings {
51        post: "/v2/{parent=projects/*/locations/*/conversations/*}/participants"
52        body: "participant"
53      }
54    };
55    option (google.api.method_signature) = "parent,participant";
56  }
57
58  // Retrieves a conversation participant.
59  rpc GetParticipant(GetParticipantRequest) returns (Participant) {
60    option (google.api.http) = {
61      get: "/v2/{name=projects/*/conversations/*/participants/*}"
62      additional_bindings {
63        get: "/v2/{name=projects/*/locations/*/conversations/*/participants/*}"
64      }
65    };
66    option (google.api.method_signature) = "name";
67  }
68
69  // Returns the list of all participants in the specified conversation.
70  rpc ListParticipants(ListParticipantsRequest)
71      returns (ListParticipantsResponse) {
72    option (google.api.http) = {
73      get: "/v2/{parent=projects/*/conversations/*}/participants"
74      additional_bindings {
75        get: "/v2/{parent=projects/*/locations/*/conversations/*}/participants"
76      }
77    };
78    option (google.api.method_signature) = "parent";
79  }
80
81  // Updates the specified participant.
82  rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) {
83    option (google.api.http) = {
84      patch: "/v2/{participant.name=projects/*/conversations/*/participants/*}"
85      body: "participant"
86      additional_bindings {
87        patch: "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}"
88        body: "participant"
89      }
90    };
91    option (google.api.method_signature) = "participant,update_mask";
92  }
93
94  // Adds a text (chat, for example), or audio (phone recording, for example)
95  // message from a participant into the conversation.
96  //
97  // Note: Always use agent versions for production traffic
98  // sent to virtual agents. See [Versions and
99  // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
100  rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) {
101    option (google.api.http) = {
102      post: "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent"
103      body: "*"
104      additional_bindings {
105        post: "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent"
106        body: "*"
107      }
108    };
109    option (google.api.method_signature) = "participant,text_input";
110    option (google.api.method_signature) = "participant,event_input";
111  }
112
113  // Adds a text (chat, for example), or audio (phone recording, for example)
114  // message from a participant into the conversation.
115  // Note: This method is only available through the gRPC API (not REST).
116  //
117  // The top-level message sent to the client by the server is
118  // `StreamingAnalyzeContentResponse`. Multiple response messages can be
119  // returned in order. The first one or more messages contain the
120  // `recognition_result` field. Each result represents a more complete
121  // transcript of what the user said. The next message contains the
122  // `reply_text` field and potentially the `reply_audio` field. The message can
123  // also contain the `automated_agent_reply` field.
124  //
125  // Note: Always use agent versions for production traffic
126  // sent to virtual agents. See [Versions and
127  // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
128  rpc StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest)
129      returns (stream StreamingAnalyzeContentResponse) {}
130
131  // Gets suggested articles for a participant based on specific historical
132  // messages.
133  rpc SuggestArticles(SuggestArticlesRequest)
134      returns (SuggestArticlesResponse) {
135    option (google.api.http) = {
136      post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles"
137      body: "*"
138      additional_bindings {
139        post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles"
140        body: "*"
141      }
142    };
143    option (google.api.method_signature) = "parent";
144  }
145
146  // Gets suggested faq answers for a participant based on specific historical
147  // messages.
148  rpc SuggestFaqAnswers(SuggestFaqAnswersRequest)
149      returns (SuggestFaqAnswersResponse) {
150    option (google.api.http) = {
151      post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers"
152      body: "*"
153      additional_bindings {
154        post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers"
155        body: "*"
156      }
157    };
158    option (google.api.method_signature) = "parent";
159  }
160
161  // Gets smart replies for a participant based on specific historical
162  // messages.
163  rpc SuggestSmartReplies(SuggestSmartRepliesRequest)
164      returns (SuggestSmartRepliesResponse) {
165    option (google.api.http) = {
166      post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies"
167      body: "*"
168      additional_bindings {
169        post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies"
170        body: "*"
171      }
172    };
173    option (google.api.method_signature) = "parent";
174  }
175}
176
177// Represents a conversation participant (human agent, virtual agent, end-user).
178message Participant {
179  option (google.api.resource) = {
180    type: "dialogflow.googleapis.com/Participant"
181    pattern: "projects/{project}/conversations/{conversation}/participants/{participant}"
182    pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}"
183  };
184
185  // Enumeration of the roles a participant can play in a conversation.
186  enum Role {
187    // Participant role not set.
188    ROLE_UNSPECIFIED = 0;
189
190    // Participant is a human agent.
191    HUMAN_AGENT = 1;
192
193    // Participant is an automated agent, such as a Dialogflow agent.
194    AUTOMATED_AGENT = 2;
195
196    // Participant is an end user that has called or chatted with
197    // Dialogflow services.
198    END_USER = 3;
199  }
200
201  // Optional. The unique identifier of this participant.
202  // Format: `projects/<Project ID>/locations/<Location
203  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
204  string name = 1 [(google.api.field_behavior) = OPTIONAL];
205
206  // Immutable. The role this participant plays in the conversation. This field
207  // must be set during participant creation and is then immutable.
208  Role role = 2 [(google.api.field_behavior) = IMMUTABLE];
209
210  // Optional. Label applied to streams representing this participant in SIPREC
211  // XML metadata and SDP. This is used to assign transcriptions from that
212  // media stream to this participant. This field can be updated.
213  string sip_recording_media_label = 6 [(google.api.field_behavior) = OPTIONAL];
214
215  // Optional. Obfuscated user id that should be associated with the created
216  // participant.
217  //
218  // You can specify a user id as follows:
219  //
220  // 1. If you set this field in
221  //    [CreateParticipantRequest][google.cloud.dialogflow.v2.CreateParticipantRequest.participant]
222  //    or
223  //    [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant],
224  //    Dialogflow adds the obfuscated user id with the participant.
225  //
226  // 2. If you set this field in
227  //    [AnalyzeContent][google.cloud.dialogflow.v2.AnalyzeContentRequest.obfuscated_external_user_id]
228  //    or
229  //    [StreamingAnalyzeContent][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.obfuscated_external_user_id],
230  //    Dialogflow will update
231  //    [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id].
232  //
233  // Dialogflow returns an error if you try to add a user id for a
234  // non-[END_USER][google.cloud.dialogflow.v2.Participant.Role.END_USER]
235  // participant.
236  //
237  // Dialogflow uses this user id for billing and measurement purposes. For
238  // example, Dialogflow determines whether a user in one conversation returned
239  // in a later conversation.
240  //
241  // Note:
242  //
243  // * Please never pass raw user ids to Dialogflow. Always obfuscate your user
244  //   id first.
245  // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a
246  //   hash function like SHA-512.
247  // * The length of the user id must be <= 256 characters.
248  string obfuscated_external_user_id = 7
249      [(google.api.field_behavior) = OPTIONAL];
250
251  // Optional. Key-value filters on the metadata of documents returned by
252  // article suggestion. If specified, article suggestion only returns suggested
253  // documents that match all filters in their
254  // [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple
255  // values for a metadata key should be concatenated by comma. For example,
256  // filters to match all documents that have 'US' or 'CA' in their market
257  // metadata values and 'agent' in their user metadata values will be
258  // ```
259  // documents_metadata_filters {
260  //   key: "market"
261  //   value: "US,CA"
262  // }
263  // documents_metadata_filters {
264  //   key: "user"
265  //   value: "agent"
266  // }
267  // ```
268  map<string, string> documents_metadata_filters = 8
269      [(google.api.field_behavior) = OPTIONAL];
270}
271
272// Represents a message posted into a conversation.
273message Message {
274  option (google.api.resource) = {
275    type: "dialogflow.googleapis.com/Message"
276    pattern: "projects/{project}/conversations/{conversation}/messages/{message}"
277    pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}"
278  };
279
280  // Optional. The unique identifier of the message.
281  // Format: `projects/<Project ID>/locations/<Location
282  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
283  string name = 1 [(google.api.field_behavior) = OPTIONAL];
284
285  // Required. The message content.
286  string content = 2 [(google.api.field_behavior) = REQUIRED];
287
288  // Optional. The message language.
289  // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
290  // language tag. Example: "en-US".
291  string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
292
293  // Output only. The participant that sends this message.
294  string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
295
296  // Output only. The role of the participant.
297  Participant.Role participant_role = 5
298      [(google.api.field_behavior) = OUTPUT_ONLY];
299
300  // Output only. The time when the message was created in Contact Center AI.
301  google.protobuf.Timestamp create_time = 6
302      [(google.api.field_behavior) = OUTPUT_ONLY];
303
304  // Optional. The time when the message was sent.
305  google.protobuf.Timestamp send_time = 9
306      [(google.api.field_behavior) = OPTIONAL];
307
308  // Output only. The annotation for the message.
309  MessageAnnotation message_annotation = 7
310      [(google.api.field_behavior) = OUTPUT_ONLY];
311
312  // Output only. The sentiment analysis result for the message.
313  SentimentAnalysisResult sentiment_analysis = 8
314      [(google.api.field_behavior) = OUTPUT_ONLY];
315}
316
317// The request message for
318// [Participants.CreateParticipant][google.cloud.dialogflow.v2.Participants.CreateParticipant].
319message CreateParticipantRequest {
320  // Required. Resource identifier of the conversation adding the participant.
321  // Format: `projects/<Project ID>/locations/<Location
322  // ID>/conversations/<Conversation ID>`.
323  string parent = 1 [
324    (google.api.field_behavior) = REQUIRED,
325    (google.api.resource_reference) = {
326      child_type: "dialogflow.googleapis.com/Participant"
327    }
328  ];
329
330  // Required. The participant to create.
331  Participant participant = 2 [(google.api.field_behavior) = REQUIRED];
332}
333
334// The request message for
335// [Participants.GetParticipant][google.cloud.dialogflow.v2.Participants.GetParticipant].
336message GetParticipantRequest {
337  // Required. The name of the participant. Format:
338  // `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
339  // ID>/participants/<Participant ID>`.
340  string name = 1 [
341    (google.api.field_behavior) = REQUIRED,
342    (google.api.resource_reference) = {
343      type: "dialogflow.googleapis.com/Participant"
344    }
345  ];
346}
347
348// The request message for
349// [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants].
350message ListParticipantsRequest {
351  // Required. The conversation to list all participants from.
352  // Format: `projects/<Project ID>/locations/<Location
353  // ID>/conversations/<Conversation ID>`.
354  string parent = 1 [
355    (google.api.field_behavior) = REQUIRED,
356    (google.api.resource_reference) = {
357      child_type: "dialogflow.googleapis.com/Participant"
358    }
359  ];
360
361  // Optional. The maximum number of items to return in a single page. By
362  // default 100 and at most 1000.
363  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
364
365  // Optional. The next_page_token value returned from a previous list request.
366  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
367}
368
369// The response message for
370// [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants].
371message ListParticipantsResponse {
372  // The list of participants. There is a maximum number of items
373  // returned based on the page_size field in the request.
374  repeated Participant participants = 1;
375
376  // Token to retrieve the next page of results or empty if there are no
377  // more results in the list.
378  string next_page_token = 2;
379}
380
381// The request message for
382// [Participants.UpdateParticipant][google.cloud.dialogflow.v2.Participants.UpdateParticipant].
383message UpdateParticipantRequest {
384  // Required. The participant to update.
385  Participant participant = 1 [(google.api.field_behavior) = REQUIRED];
386
387  // Required. The mask to specify which fields to update.
388  google.protobuf.FieldMask update_mask = 2
389      [(google.api.field_behavior) = REQUIRED];
390}
391
392// The request message for
393// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent].
394message AnalyzeContentRequest {
395  // Required. The name of the participant this text comes from.
396  // Format: `projects/<Project ID>/locations/<Location
397  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
398  string participant = 1 [
399    (google.api.field_behavior) = REQUIRED,
400    (google.api.resource_reference) = {
401      type: "dialogflow.googleapis.com/Participant"
402    }
403  ];
404
405  // Required. The input content.
406  oneof input {
407    // The natural language text to be processed.
408    TextInput text_input = 6;
409
410    // An input event to send to Dialogflow.
411    EventInput event_input = 8;
412  }
413
414  // Speech synthesis configuration.
415  // The speech synthesis settings for a virtual agent that may be configured
416  // for the associated conversation profile are not used when calling
417  // AnalyzeContent. If this configuration is not supplied, speech synthesis
418  // is disabled.
419  OutputAudioConfig reply_audio_config = 5;
420
421  // Parameters for a Dialogflow virtual-agent query.
422  QueryParameters query_params = 9;
423
424  // Parameters for a human assist query.
425  AssistQueryParameters assist_query_params = 14;
426
427  // Additional parameters to be put into Dialogflow CX session parameters. To
428  // remove a parameter from the session, clients should explicitly set the
429  // parameter value to null.
430  //
431  // Note: this field should only be used if you are connecting to a Dialogflow
432  // CX agent.
433  google.protobuf.Struct cx_parameters = 18;
434
435  // A unique identifier for this request. Restricted to 36 ASCII characters.
436  // A random UUID is recommended.
437  // This request is only idempotent if a `request_id` is provided.
438  string request_id = 11;
439}
440
441// The message in the response that indicates the parameters of DTMF.
442message DtmfParameters {
443  // Indicates whether DTMF input can be handled in the next request.
444  bool accepts_dtmf_input = 1;
445}
446
447// The response message for
448// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent].
449message AnalyzeContentResponse {
450  // The output text content.
451  // This field is set if the automated agent responded with text to show to
452  // the user.
453  string reply_text = 1;
454
455  // The audio data bytes encoded as specified in the request.
456  // This field is set if:
457  //
458  //  - `reply_audio_config` was specified in the request, or
459  //  - The automated agent responded with audio to play to the user. In such
460  //    case, `reply_audio.config` contains settings used to synthesize the
461  //    speech.
462  //
463  // In some scenarios, multiple output audio fields may be present in the
464  // response structure. In these cases, only the top-most-level audio output
465  // has content.
466  OutputAudio reply_audio = 2;
467
468  // Only set if a Dialogflow automated agent has responded.
469  // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][]
470  // and [AutomatedAgentReply.detect_intent_response.output_audio_config][]
471  // are always empty, use
472  // [reply_audio][google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio]
473  // instead.
474  AutomatedAgentReply automated_agent_reply = 3;
475
476  // Message analyzed by CCAI.
477  Message message = 5;
478
479  // The suggestions for most recent human agent. The order is the same as
480  // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
481  // of
482  // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config].
483  //
484  // Note that any failure of Agent Assist features will not lead to the overall
485  // failure of an AnalyzeContent API call. Instead, the features will
486  // fail silently with the error field set in the corresponding
487  // SuggestionResult.
488  repeated SuggestionResult human_agent_suggestion_results = 6;
489
490  // The suggestions for end user. The order is the same as
491  // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
492  // of
493  // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config].
494  //
495  // Same as human_agent_suggestion_results, any failure of Agent Assist
496  // features will not lead to the overall failure of an AnalyzeContent API
497  // call. Instead, the features will fail silently with the error field set in
498  // the corresponding SuggestionResult.
499  repeated SuggestionResult end_user_suggestion_results = 7;
500
501  // Indicates the parameters of DTMF.
502  DtmfParameters dtmf_parameters = 9;
503}
504
505// The top-level message sent by the client to the
506// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]
507// method.
508//
509// Multiple request messages should be sent in order:
510//
511// 1.  The first message must contain
512//     [participant][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant],
513//     [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config]
514//     and optionally
515//     [query_params][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params].
516//     If you want to receive an audio response, it should also contain
517//     [reply_audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config].
518//     The message must not contain
519//     [input][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input].
520//
521// 2.  If
522// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in
523// the first message
524//     was set to
525//     [audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config],
526//     all subsequent messages must contain
527//     [input_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio]
528//     to continue with Speech recognition. However, note that:
529//
530//     * Dialogflow will bill you for the audio so far.
531//     * Dialogflow discards all Speech recognition results in favor of the
532//       text input.
533//
534//  3. If
535//  [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config]
536//  in the first message was set
537//    to
538//    [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config],
539//    then the second message must contain only
540//    [input_text][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text].
541//    Moreover, you must not send more than two messages.
542//
543//  After you sent all input, you must half-close or abort the request stream.
544message StreamingAnalyzeContentRequest {
545  // Required. The name of the participant this text comes from.
546  // Format: `projects/<Project ID>/locations/<Location
547  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
548  string participant = 1 [
549    (google.api.field_behavior) = REQUIRED,
550    (google.api.resource_reference) = {
551      type: "dialogflow.googleapis.com/Participant"
552    }
553  ];
554
555  // The input config.
556  oneof config {
557    // Instructs the speech recognizer how to process the speech audio.
558    InputAudioConfig audio_config = 2;
559
560    // The natural language text to be processed.
561    InputTextConfig text_config = 3;
562  }
563
564  // Speech synthesis configuration.
565  // The speech synthesis settings for a virtual agent that may be configured
566  // for the associated conversation profile are not used when calling
567  // StreamingAnalyzeContent. If this configuration is not supplied, speech
568  // synthesis is disabled.
569  OutputAudioConfig reply_audio_config = 4;
570
571  // The input.
572  oneof input {
573    // The input audio content to be recognized. Must be sent if `audio_config`
574    // is set in the first message. The complete audio over all streaming
575    // messages must not exceed 1 minute.
576    bytes input_audio = 5;
577
578    // The UTF-8 encoded natural language text to be processed. Must be sent if
579    // `text_config` is set in the first message. Text length must not exceed
580    // 256 bytes for virtual agent interactions. The `input_text` field can be
581    // only sent once.
582    string input_text = 6;
583
584    // The DTMF digits used to invoke intent and fill in parameter value.
585    //
586    // This input is ignored if the previous response indicated that DTMF input
587    // is not accepted.
588    TelephonyDtmfEvents input_dtmf = 9;
589  }
590
591  // Parameters for a Dialogflow virtual-agent query.
592  QueryParameters query_params = 7;
593
594  // Parameters for a human assist query.
595  AssistQueryParameters assist_query_params = 8;
596
597  // Additional parameters to be put into Dialogflow CX session parameters. To
598  // remove a parameter from the session, clients should explicitly set the
599  // parameter value to null.
600  //
601  // Note: this field should only be used if you are connecting to a Dialogflow
602  // CX agent.
603  google.protobuf.Struct cx_parameters = 13;
604
605  // Enable partial virtual agent responses. If this flag is not enabled,
606  // response stream still contains only one final response even if some
607  // `Fulfillment`s in Dialogflow virtual agent have been configured to return
608  // partial responses.
609  bool enable_partial_automated_agent_reply = 12;
610
611  // If true, `StreamingAnalyzeContentResponse.debugging_info` will get
612  // populated.
613  bool enable_debugging_info = 19;
614}
615
616// The top-level message returned from the `StreamingAnalyzeContent` method.
617//
618// Multiple response messages can be returned in order:
619//
620// 1.  If the input was set to streaming audio, the first one or more messages
621//     contain `recognition_result`. Each `recognition_result` represents a more
622//     complete transcript of what the user said. The last `recognition_result`
623//     has `is_final` set to `true`.
624//
625// 2.  In virtual agent stage: if `enable_partial_automated_agent_reply` is
626//     true, the following N (currently 1 <= N <= 4) messages
627//     contain `automated_agent_reply` and optionally `reply_audio`
628//     returned by the virtual agent. The first (N-1)
629//     `automated_agent_reply`s will have `automated_agent_reply_type` set to
630//     `PARTIAL`. The last `automated_agent_reply` has
631//     `automated_agent_reply_type` set to `FINAL`.
632//     If `enable_partial_automated_agent_reply` is not enabled, response stream
633//     only contains the final reply.
634//
635//     In human assist stage: the following N (N >= 1) messages contain
636//     `human_agent_suggestion_results`, `end_user_suggestion_results` or
637//     `message`.
638message StreamingAnalyzeContentResponse {
639  // The result of speech recognition.
640  StreamingRecognitionResult recognition_result = 1;
641
642  // The output text content.
643  // This field is set if an automated agent responded with a text for the user.
644  string reply_text = 2;
645
646  // The audio data bytes encoded as specified in the request.
647  // This field is set if:
648  //
649  //  - The `reply_audio_config` field is specified in the request.
650  //  - The automated agent, which this output comes from, responded with audio.
651  //    In such case, the `reply_audio.config` field contains settings used to
652  //    synthesize the speech.
653  //
654  // In some scenarios, multiple output audio fields may be present in the
655  // response structure. In these cases, only the top-most-level audio output
656  // has content.
657  OutputAudio reply_audio = 3;
658
659  // Only set if a Dialogflow automated agent has responded.
660  // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][]
661  // and [AutomatedAgentReply.detect_intent_response.output_audio_config][]
662  // are always empty, use
663  // [reply_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.reply_audio]
664  // instead.
665  AutomatedAgentReply automated_agent_reply = 4;
666
667  // Message analyzed by CCAI.
668  Message message = 6;
669
670  // The suggestions for most recent human agent. The order is the same as
671  // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
672  // of
673  // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config].
674  repeated SuggestionResult human_agent_suggestion_results = 7;
675
676  // The suggestions for end user. The order is the same as
677  // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
678  // of
679  // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config].
680  repeated SuggestionResult end_user_suggestion_results = 8;
681
682  // Indicates the parameters of DTMF.
683  DtmfParameters dtmf_parameters = 10;
684
685  // Debugging info that would get populated when
686  // `StreamingAnalyzeContentRequest.enable_debugging_info` is set to true.
687  CloudConversationDebuggingInfo debugging_info = 11;
688}
689
690// The request message for
691// [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles].
692message SuggestArticlesRequest {
693  // Required. The name of the participant to fetch suggestion for.
694  // Format: `projects/<Project ID>/locations/<Location
695  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
696  string parent = 1 [
697    (google.api.field_behavior) = REQUIRED,
698    (google.api.resource_reference) = {
699      type: "dialogflow.googleapis.com/Participant"
700    }
701  ];
702
703  // Optional. The name of the latest conversation message to compile suggestion
704  // for. If empty, it will be the latest message of the conversation.
705  //
706  // Format: `projects/<Project ID>/locations/<Location
707  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
708  string latest_message = 2 [
709    (google.api.field_behavior) = OPTIONAL,
710    (google.api.resource_reference) = {
711      type: "dialogflow.googleapis.com/Message"
712    }
713  ];
714
715  // Optional. Max number of messages prior to and including
716  // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message]
717  // to use as context when compiling the suggestion. By default 20 and at
718  // most 50.
719  int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL];
720
721  // Parameters for a human assist query.
722  AssistQueryParameters assist_query_params = 4;
723}
724
725// The response message for
726// [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles].
727message SuggestArticlesResponse {
728  // Articles ordered by score in descending order.
729  repeated ArticleAnswer article_answers = 1;
730
731  // The name of the latest conversation message used to compile
732  // suggestion for.
733  //
734  // Format: `projects/<Project ID>/locations/<Location
735  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
736  string latest_message = 2;
737
738  // Number of messages prior to and including
739  // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message]
740  // to compile the suggestion. It may be smaller than the
741  // [SuggestArticlesRequest.context_size][google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size]
742  // field in the request if there aren't that many messages in the
743  // conversation.
744  int32 context_size = 3;
745}
746
747// The request message for
748// [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers].
749message SuggestFaqAnswersRequest {
750  // Required. The name of the participant to fetch suggestion for.
751  // Format: `projects/<Project ID>/locations/<Location
752  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
753  string parent = 1 [
754    (google.api.field_behavior) = REQUIRED,
755    (google.api.resource_reference) = {
756      type: "dialogflow.googleapis.com/Participant"
757    }
758  ];
759
760  // Optional. The name of the latest conversation message to compile suggestion
761  // for. If empty, it will be the latest message of the conversation.
762  //
763  // Format: `projects/<Project ID>/locations/<Location
764  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
765  string latest_message = 2 [
766    (google.api.field_behavior) = OPTIONAL,
767    (google.api.resource_reference) = {
768      type: "dialogflow.googleapis.com/Message"
769    }
770  ];
771
772  // Optional. Max number of messages prior to and including
773  // [latest_message] to use as context when compiling the
774  // suggestion. By default 20 and at most 50.
775  int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL];
776
777  // Parameters for a human assist query.
778  AssistQueryParameters assist_query_params = 4;
779}
780
781// The request message for
782// [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers].
783message SuggestFaqAnswersResponse {
784  // Answers extracted from FAQ documents.
785  repeated FaqAnswer faq_answers = 1;
786
787  // The name of the latest conversation message used to compile
788  // suggestion for.
789  //
790  // Format: `projects/<Project ID>/locations/<Location
791  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
792  string latest_message = 2;
793
794  // Number of messages prior to and including
795  // [latest_message][google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message]
796  // to compile the suggestion. It may be smaller than the
797  // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size]
798  // field in the request if there aren't that many messages in the
799  // conversation.
800  int32 context_size = 3;
801}
802
803// The request message for
804// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies].
805message SuggestSmartRepliesRequest {
806  // Required. The name of the participant to fetch suggestion for.
807  // Format: `projects/<Project ID>/locations/<Location
808  // ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
809  string parent = 1 [
810    (google.api.field_behavior) = REQUIRED,
811    (google.api.resource_reference) = {
812      type: "dialogflow.googleapis.com/Participant"
813    }
814  ];
815
816  // The current natural language text segment to compile suggestion
817  // for. This provides a way for user to get follow up smart reply suggestion
818  // after a smart reply selection, without sending a text message.
819  TextInput current_text_input = 4;
820
821  // The name of the latest conversation message to compile suggestion
822  // for. If empty, it will be the latest message of the conversation.
823  //
824  // Format: `projects/<Project ID>/locations/<Location
825  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
826  string latest_message = 2 [(google.api.resource_reference) = {
827    type: "dialogflow.googleapis.com/Message"
828  }];
829
830  // Max number of messages prior to and including
831  // [latest_message] to use as context when compiling the
832  // suggestion. By default 20 and at most 50.
833  int32 context_size = 3;
834}
835
836// The response message for
837// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies].
838message SuggestSmartRepliesResponse {
839  // Output only. Multiple reply options provided by smart reply service. The
840  // order is based on the rank of the model prediction.
841  // The maximum number of the returned replies is set in SmartReplyConfig.
842  repeated SmartReplyAnswer smart_reply_answers = 1
843      [(google.api.field_behavior) = OUTPUT_ONLY];
844
845  // The name of the latest conversation message used to compile
846  // suggestion for.
847  //
848  // Format: `projects/<Project ID>/locations/<Location
849  // ID>/conversations/<Conversation ID>/messages/<Message ID>`.
850  string latest_message = 2 [(google.api.resource_reference) = {
851    type: "dialogflow.googleapis.com/Message"
852  }];
853
854  // Number of messages prior to and including
855  // [latest_message][google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message]
856  // to compile the suggestion. It may be smaller than the
857  // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.context_size]
858  // field in the request if there aren't that many messages in the
859  // conversation.
860  int32 context_size = 3;
861}
862
863// Represents the natural language speech audio to be played to the end user.
864message OutputAudio {
865  // Instructs the speech synthesizer how to generate the speech
866  // audio.
867  OutputAudioConfig config = 1;
868
869  // The natural language speech audio.
870  bytes audio = 2;
871}
872
873// Represents a response from an automated agent.
874message AutomatedAgentReply {
875  // Represents different automated agent reply types.
876  enum AutomatedAgentReplyType {
877    // Not specified. This should never happen.
878    AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0;
879
880    // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables
881    // `return_partial_response` can be returned as partial reply.
882    // WARNING: partial reply is not eligible for barge-in.
883    PARTIAL = 1;
884
885    // Final reply.
886    FINAL = 2;
887  }
888
889  // Response of the Dialogflow
890  // [Sessions.DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent]
891  // call.
892  DetectIntentResponse detect_intent_response = 1;
893
894  // AutomatedAgentReply type.
895  AutomatedAgentReplyType automated_agent_reply_type = 7;
896
897  // Indicates whether the partial automated agent reply is interruptible when a
898  // later reply message arrives. e.g. if the agent specified some music as
899  // partial response, it can be cancelled.
900  bool allow_cancellation = 8;
901
902  // The unique identifier of the current Dialogflow CX conversation page.
903  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
904  // ID>/flows/<Flow ID>/pages/<Page ID>`.
905  string cx_current_page = 11;
906}
907
908// Represents article answer.
909message ArticleAnswer {
910  // The article title.
911  string title = 1;
912
913  // The article URI.
914  string uri = 2;
915
916  // Article snippets.
917  repeated string snippets = 3;
918
919  // Article match confidence.
920  // The system's confidence score that this article is a good match for this
921  // conversation, as a value from 0.0 (completely uncertain) to 1.0
922  // (completely certain).
923  float confidence = 4;
924
925  // A map that contains metadata about the answer and the
926  // document from which it originates.
927  map<string, string> metadata = 5;
928
929  // The name of answer record, in the format of
930  // "projects/<Project ID>/locations/<Location ID>/answerRecords/<Answer Record
931  // ID>"
932  string answer_record = 6;
933}
934
935// Represents answer from "frequently asked questions".
936message FaqAnswer {
937  // The piece of text from the `source` knowledge base document.
938  string answer = 1;
939
940  // The system's confidence score that this Knowledge answer is a good match
941  // for this conversational query, range from 0.0 (completely uncertain)
942  // to 1.0 (completely certain).
943  float confidence = 2;
944
945  // The corresponding FAQ question.
946  string question = 3;
947
948  // Indicates which Knowledge Document this answer was extracted
949  // from.
950  // Format: `projects/<Project ID>/locations/<Location
951  // ID>/agent/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
952  string source = 4;
953
954  // A map that contains metadata about the answer and the
955  // document from which it originates.
956  map<string, string> metadata = 5;
957
958  // The name of answer record, in the format of
959  // "projects/<Project ID>/locations/<Location ID>/answerRecords/<Answer Record
960  // ID>"
961  string answer_record = 6;
962}
963
964// Represents a smart reply answer.
965message SmartReplyAnswer {
966  // The content of the reply.
967  string reply = 1;
968
969  // Smart reply confidence.
970  // The system's confidence score that this reply is a good match for
971  // this conversation, as a value from 0.0 (completely uncertain) to 1.0
972  // (completely certain).
973  float confidence = 2;
974
975  // The name of answer record, in the format of
976  // "projects/<Project ID>/locations/<Location ID>/answerRecords/<Answer Record
977  // ID>"
978  string answer_record = 3 [(google.api.resource_reference) = {
979    type: "dialogflow.googleapis.com/AnswerRecord"
980  }];
981}
982
983// One response of different type of suggestion response which is used in
984// the response of
985// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
986// and
987// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent],
988// as well as
989// [HumanAgentAssistantEvent][google.cloud.dialogflow.v2.HumanAgentAssistantEvent].
990message SuggestionResult {
991  // Different type of suggestion response.
992  oneof suggestion_response {
993    // Error status if the request failed.
994    google.rpc.Status error = 1;
995
996    // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION.
997    SuggestArticlesResponse suggest_articles_response = 2;
998
999    // SuggestFaqAnswersResponse if request is for FAQ_ANSWER.
1000    SuggestFaqAnswersResponse suggest_faq_answers_response = 3;
1001
1002    // SuggestSmartRepliesResponse if request is for SMART_REPLY.
1003    SuggestSmartRepliesResponse suggest_smart_replies_response = 4;
1004  }
1005}
1006
1007// Defines the language used in the input text.
1008message InputTextConfig {
1009  // Required. The language of this conversational query. See [Language
1010  // Support](https://cloud.google.com/dialogflow/docs/reference/language)
1011  // for a list of the currently supported language codes.
1012  string language_code = 1 [(google.api.field_behavior) = REQUIRED];
1013}
1014
1015// Represents a part of a message possibly annotated with an entity. The part
1016// can be an entity or purely a part of the message between two entities or
1017// message start/end.
1018message AnnotatedMessagePart {
1019  // A part of a message possibly annotated with an entity.
1020  string text = 1;
1021
1022  // The [Dialogflow system entity
1023  // type](https://cloud.google.com/dialogflow/docs/reference/system-entities)
1024  // of this message part. If this is empty, Dialogflow could not annotate the
1025  // phrase part with a system entity.
1026  string entity_type = 2;
1027
1028  // The [Dialogflow system entity formatted value
1029  // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of
1030  // this message part. For example for a system entity of type
1031  // `@sys.unit-currency`, this may contain:
1032  // <pre>
1033  // {
1034  //   "amount": 5,
1035  //   "currency": "USD"
1036  // }
1037  // </pre>
1038  google.protobuf.Value formatted_value = 3;
1039}
1040
1041// Represents the result of annotation for the message.
1042message MessageAnnotation {
1043  // The collection of annotated message parts ordered by their
1044  // position in the message. You can recover the annotated message by
1045  // concatenating [AnnotatedMessagePart.text].
1046  repeated AnnotatedMessagePart parts = 1;
1047
1048  // Indicates whether the text message contains entities.
1049  bool contain_entities = 2;
1050}
1051
1052// Represents the parameters of human assist query.
1053message AssistQueryParameters {
1054  // Key-value filters on the metadata of documents returned by article
1055  // suggestion. If specified, article suggestion only returns suggested
1056  // documents that match all filters in their
1057  // [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple
1058  // values for a metadata key should be concatenated by comma. For example,
1059  // filters to match all documents that have 'US' or 'CA' in their market
1060  // metadata values and 'agent' in their user metadata values will be
1061  // ```
1062  // documents_metadata_filters {
1063  //   key: "market"
1064  //   value: "US,CA"
1065  // }
1066  // documents_metadata_filters {
1067  //   key: "user"
1068  //   value: "agent"
1069  // }
1070  // ```
1071  map<string, string> documents_metadata_filters = 1;
1072}
1073