-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
session.proto
1215 lines (1056 loc) · 49.5 KB
/
session.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.dialogflow.cx.v3;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/dialogflow/cx/v3/advanced_settings.proto";
import "google/cloud/dialogflow/cx/v3/audio_config.proto";
import "google/cloud/dialogflow/cx/v3/intent.proto";
import "google/cloud/dialogflow/cx/v3/page.proto";
import "google/cloud/dialogflow/cx/v3/response_message.proto";
import "google/cloud/dialogflow/cx/v3/session_entity_type.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";
import "google/rpc/status.proto";
import "google/type/latlng.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3";
option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb";
option java_multiple_files = true;
option java_outer_classname = "SessionProto";
option java_package = "com.google.cloud.dialogflow.cx.v3";
option objc_class_prefix = "DF";
option ruby_package = "Google::Cloud::Dialogflow::CX::V3";
option (google.api.resource_definition) = {
type: "dialogflow.googleapis.com/Session"
pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"
pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}"
};
option (google.api.resource_definition) = {
type: "discoveryengine.googleapis.com/DataStore"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}"
};
// A session represents an interaction with a user. You retrieve user input
// and pass it to the
// [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to
// determine user intent and respond.
service Sessions {
option (google.api.default_host) = "dialogflow.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/dialogflow";
// Processes a natural language query and returns structured, actionable data
// as a result. This method is not idempotent, because it may cause session
// entity types to be updated, which in turn might affect results of future
// queries.
//
// Note: Always use agent versions for production traffic.
// See [Versions and
// environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) {
option (google.api.http) = {
post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent"
body: "*"
additional_bindings {
post: "/v3/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent"
body: "*"
}
};
}
// Processes a natural language query in audio format in a streaming fashion
// and returns structured, actionable data as a result. This method is only
// available via the gRPC API (not REST).
//
// Note: Always use agent versions for production traffic.
// See [Versions and
// environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
rpc StreamingDetectIntent(stream StreamingDetectIntentRequest)
returns (stream StreamingDetectIntentResponse) {}
// Returns preliminary intent match results, doesn't change the session
// status.
rpc MatchIntent(MatchIntentRequest) returns (MatchIntentResponse) {
option (google.api.http) = {
post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent"
body: "*"
additional_bindings {
post: "/v3/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent"
body: "*"
}
};
}
// Fulfills a matched intent returned by
// [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be
// called after
// [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent], with
// input from
// [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse].
// Otherwise, the behavior is undefined.
rpc FulfillIntent(FulfillIntentRequest) returns (FulfillIntentResponse) {
option (google.api.http) = {
post: "/v3/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent"
body: "*"
additional_bindings {
post: "/v3/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent"
body: "*"
}
};
}
// Updates the feedback received from the user for a single turn of the bot
// response.
rpc SubmitAnswerFeedback(SubmitAnswerFeedbackRequest)
returns (AnswerFeedback) {
option (google.api.http) = {
post: "/v3/{session=projects/*/locations/*/agents/*/sessions/*}:submitAnswerFeedback"
body: "*"
};
}
}
// Stores information about feedback provided by users about a response.
message AnswerFeedback {
// Represents thumbs up/down rating provided by user about a response.
enum Rating {
// Rating not specified.
RATING_UNSPECIFIED = 0;
// Thumbs up feedback from user.
THUMBS_UP = 1;
// Thumbs down feedback from user.
THUMBS_DOWN = 2;
}
// Stores extra information about why users provided thumbs down rating.
message RatingReason {
// Optional. Custom reason labels for thumbs down rating provided by the
// user. The maximum number of labels allowed is 10 and the maximum length
// of a single label is 128 characters.
repeated string reason_labels = 3 [(google.api.field_behavior) = OPTIONAL];
// Optional. Additional feedback about the rating.
// This field can be populated without choosing a predefined `reason`.
string feedback = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Optional. Rating from user for the specific Dialogflow response.
Rating rating = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. In case of thumbs down rating provided, users can optionally
// provide context about the rating.
RatingReason rating_reason = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Custom rating from the user about the provided answer, with
// maximum length of 1024 characters. For example, client could use a
// customized JSON object to indicate the rating.
string custom_rating = 3 [(google.api.field_behavior) = OPTIONAL];
}
// The request to set the feedback for a bot answer.
message SubmitAnswerFeedbackRequest {
// Required. The name of the session the feedback was sent to.
string session = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Session"
}
];
// Required. ID of the response to update its feedback. This is the same as
// DetectIntentResponse.response_id.
string response_id = 2 [(google.api.field_behavior) = REQUIRED];
// Required. Feedback provided for a bot answer.
AnswerFeedback answer_feedback = 3 [(google.api.field_behavior) = REQUIRED];
// Optional. The mask to control which fields to update. If the mask is not
// present, all fields will be updated.
google.protobuf.FieldMask update_mask = 4
[(google.api.field_behavior) = OPTIONAL];
}
// The request to detect user's intent.
message DetectIntentRequest {
// Required. The name of the session this query is sent to.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
// ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
// If `Environment ID` is not specified, we assume default 'draft'
// environment.
// It's up to the API caller to choose an appropriate `Session ID`. It can be
// a random number or some type of session identifiers (preferably hashed).
// The length of the `Session ID` must not exceed 36 characters.
//
// For more information, see the [sessions
// guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
//
// Note: Always use agent versions for production traffic.
// See [Versions and
// environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
string session = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Session"
}
];
// The parameters of this query.
QueryParameters query_params = 2;
// Required. The input specification.
QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED];
// Instructs the speech synthesizer how to generate the output audio.
OutputAudioConfig output_audio_config = 4;
}
// The message returned from the DetectIntent method.
message DetectIntentResponse {
// Represents different DetectIntentResponse types.
enum ResponseType {
// Not specified. This should never happen.
RESPONSE_TYPE_UNSPECIFIED = 0;
// Partial response. e.g. Aggregated responses in a Fulfillment that enables
// `return_partial_response` can be returned as partial response.
// WARNING: partial response is not eligible for barge-in.
PARTIAL = 1;
// Final response.
FINAL = 2;
}
// Output only. The unique identifier of the response. It can be used to
// locate a response in the training example set or for reporting issues.
string response_id = 1;
// The result of the conversational query.
QueryResult query_result = 2;
// The audio data bytes encoded as specified in the request.
// Note: The output audio is generated based on the values of default platform
// text responses found in the
// [`query_result.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_messages]
// field. If multiple default text responses exist, they will be concatenated
// when generating audio. If no default platform text responses exist, the
// generated audio content will be empty.
//
// In some scenarios, multiple output audio fields may be present in the
// response structure. In these cases, only the top-most-level audio output
// has content.
bytes output_audio = 4;
// The config used by the speech synthesizer to generate the output audio.
OutputAudioConfig output_audio_config = 5;
// Response type.
ResponseType response_type = 6;
// Indicates whether the partial response can be cancelled when a later
// response arrives. e.g. if the agent specified some music as partial
// response, it can be cancelled.
bool allow_cancellation = 7;
}
// The top-level message sent by the client to the
// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent]
// method.
//
// Multiple request messages should be sent in order:
//
// 1. The first message must contain
// [session][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.session],
// [query_input][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_input]
// plus optionally
// [query_params][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_params].
// If the client wants to receive an audio response, it should also contain
// [output_audio_config][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.output_audio_config].
//
// 2. If
// [query_input][google.cloud.dialogflow.cx.v3.StreamingDetectIntentRequest.query_input]
// was set to
// [query_input.audio.config][google.cloud.dialogflow.cx.v3.AudioInput.config],
// all subsequent messages must contain
// [query_input.audio.audio][google.cloud.dialogflow.cx.v3.AudioInput.audio]
// to continue with Speech recognition. If you decide to rather detect an
// intent from text input after you already started Speech recognition,
// please send a message with
// [query_input.text][google.cloud.dialogflow.cx.v3.QueryInput.text].
//
// However, note that:
//
// * Dialogflow will bill you for the audio duration so far.
// * Dialogflow discards all Speech recognition results in favor of the
// input text.
// * Dialogflow will use the language code from the first message.
//
// After you sent all input, you must half-close or abort the request stream.
message StreamingDetectIntentRequest {
// The name of the session this query is sent to.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
// ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
// If `Environment ID` is not specified, we assume default 'draft'
// environment.
// It's up to the API caller to choose an appropriate `Session ID`. It can be
// a random number or some type of session identifiers (preferably hashed).
// The length of the `Session ID` must not exceed 36 characters.
// Note: session must be set in the first request.
//
// For more information, see the [sessions
// guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
//
// Note: Always use agent versions for production traffic.
// See [Versions and
// environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
string session = 1 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Session"
}];
// The parameters of this query.
QueryParameters query_params = 2;
// Required. The input specification.
QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED];
// Instructs the speech synthesizer how to generate the output audio.
OutputAudioConfig output_audio_config = 4;
// Enable partial detect intent response. If this flag is not enabled,
// response stream still contains only one final `DetectIntentResponse` even
// if some `Fulfillment`s in the agent have been configured to return partial
// responses.
bool enable_partial_response = 5;
// If true, `StreamingDetectIntentResponse.debugging_info` will get populated.
bool enable_debugging_info = 8;
}
// Cloud conversation info for easier debugging.
// It will get populated in `StreamingDetectIntentResponse` or
// `StreamingAnalyzeContentResponse` when the flag `enable_debugging_info` is
// set to true in corresponding requests.
message CloudConversationDebuggingInfo {
// Number of input audio data chunks in streaming requests.
int32 audio_data_chunks = 1;
// Time offset of the end of speech utterance relative to the
// beginning of the first audio chunk.
google.protobuf.Duration result_end_time_offset = 2;
// Duration of first audio chunk.
google.protobuf.Duration first_audio_duration = 3;
// Whether client used single utterance mode.
bool single_utterance = 5;
// Time offsets of the speech partial results relative to the beginning of
// the stream.
repeated google.protobuf.Duration speech_partial_results_end_times = 6;
// Time offsets of the speech final results (is_final=true) relative to the
// beginning of the stream.
repeated google.protobuf.Duration speech_final_results_end_times = 7;
// Total number of partial responses.
int32 partial_responses = 8;
// Time offset of Speaker ID stream close time relative to the Speech stream
// close time in milliseconds. Only meaningful for conversations involving
// passive verification.
int32 speaker_id_passive_latency_ms_offset = 9;
// Whether a barge-in event is triggered in this request.
bool bargein_event_triggered = 10;
// Whether speech uses single utterance mode.
bool speech_single_utterance = 11;
// Time offsets of the DTMF partial results relative to the beginning of
// the stream.
repeated google.protobuf.Duration dtmf_partial_results_times = 12;
// Time offsets of the DTMF final results relative to the beginning of
// the stream.
repeated google.protobuf.Duration dtmf_final_results_times = 13;
// Time offset of the end-of-single-utterance signal relative to the
// beginning of the stream.
google.protobuf.Duration single_utterance_end_time_offset = 14;
// No speech timeout settings for the stream.
google.protobuf.Duration no_speech_timeout = 15;
// Speech endpointing timeout settings for the stream.
google.protobuf.Duration endpointing_timeout = 19;
// Whether the streaming terminates with an injected text query.
bool is_input_text = 16;
// Client half close time in terms of input audio duration.
google.protobuf.Duration client_half_close_time_offset = 17;
// Client half close time in terms of API streaming duration.
google.protobuf.Duration client_half_close_streaming_time_offset = 18;
}
// The top-level message returned from the
// [StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent]
// method.
//
// Multiple response messages (N) can be returned in order.
//
// The first (N-1) responses set either the `recognition_result` or
// `detect_intent_response` field, depending on the request:
//
// * If the `StreamingDetectIntentRequest.query_input.audio` field was
// set, and the `StreamingDetectIntentRequest.enable_partial_response`
// field was false, the `recognition_result` field is populated for each
// of the (N-1) responses.
// See the
// [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.StreamingRecognitionResult]
// message for details about the result message sequence.
//
// * If the `StreamingDetectIntentRequest.enable_partial_response` field was
// true, the `detect_intent_response` field is populated for each
// of the (N-1) responses, where 1 <= N <= 4.
// These responses set the
// [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type]
// field to `PARTIAL`.
//
// For the final Nth response message, the `detect_intent_response` is fully
// populated, and
// [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type]
// is set to `FINAL`.
message StreamingDetectIntentResponse {
// The output response.
oneof response {
// The result of speech recognition.
StreamingRecognitionResult recognition_result = 1;
// The response from detect intent.
DetectIntentResponse detect_intent_response = 2;
}
// Debugging info that would get populated when
// `StreamingDetectIntentRequest.enable_debugging_info` is set to true.
CloudConversationDebuggingInfo debugging_info = 4;
}
// Contains a speech recognition result corresponding to a portion of the audio
// that is currently being processed or an indication that this is the end
// of the single requested utterance.
//
// While end-user audio is being processed, Dialogflow sends a series of
// results. Each result may contain a `transcript` value. A transcript
// represents a portion of the utterance. While the recognizer is processing
// audio, transcript values may be interim values or finalized values.
// Once a transcript is finalized, the `is_final` value is set to true and
// processing continues for the next transcript.
//
// If `StreamingDetectIntentRequest.query_input.audio.config.single_utterance`
// was true, and the recognizer has completed processing audio,
// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the
// following (last) result contains the last finalized transcript.
//
// The complete end-user utterance is determined by concatenating the
// finalized transcript values received for the series of results.
//
// In the following example, single utterance is enabled. In the case where
// single utterance is not enabled, result 7 would not occur.
//
// ```
// Num | transcript | message_type | is_final
// --- | ----------------------- | ----------------------- | --------
// 1 | "tube" | TRANSCRIPT | false
// 2 | "to be a" | TRANSCRIPT | false
// 3 | "to be" | TRANSCRIPT | false
// 4 | "to be or not to be" | TRANSCRIPT | true
// 5 | "that's" | TRANSCRIPT | false
// 6 | "that is | TRANSCRIPT | false
// 7 | unset | END_OF_SINGLE_UTTERANCE | unset
// 8 | " that is the question" | TRANSCRIPT | true
// ```
//
// Concatenating the finalized transcripts with `is_final` set to true,
// the complete utterance becomes "to be or not to be that is the question".
message StreamingRecognitionResult {
// Type of the response message.
enum MessageType {
// Not specified. Should never be used.
MESSAGE_TYPE_UNSPECIFIED = 0;
// Message contains a (possibly partial) transcript.
TRANSCRIPT = 1;
// Event indicates that the server has detected the end of the user's speech
// utterance and expects no additional speech. Therefore, the server will
// not process additional audio (although it may subsequently return
// additional results). The client should stop sending additional audio
// data, half-close the gRPC connection, and wait for any additional results
// until the server closes the gRPC connection. This message is only sent if
// [`single_utterance`][google.cloud.dialogflow.cx.v3.InputAudioConfig.single_utterance]
// was set to `true`, and is not used otherwise.
END_OF_SINGLE_UTTERANCE = 2;
}
// Type of the result message.
MessageType message_type = 1;
// Transcript text representing the words that the user spoke.
// Populated if and only if `message_type` = `TRANSCRIPT`.
string transcript = 2;
// If `false`, the `StreamingRecognitionResult` represents an
// interim result that may change. If `true`, the recognizer will not return
// any further hypotheses about this piece of the audio. May only be populated
// for `message_type` = `TRANSCRIPT`.
bool is_final = 3;
// The Speech confidence between 0.0 and 1.0 for the current portion of audio.
// A higher number indicates an estimated greater likelihood that the
// recognized words are correct. The default of 0.0 is a sentinel value
// indicating that confidence was not set.
//
// This field is typically only provided if `is_final` is true and you should
// not rely on it being accurate or even set.
float confidence = 4;
// An estimate of the likelihood that the speech recognizer will
// not change its guess about this interim recognition result:
// * If the value is unspecified or 0.0, Dialogflow didn't compute the
// stability. In particular, Dialogflow will only provide stability for
// `TRANSCRIPT` results with `is_final = false`.
// * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely
// unstable and 1.0 means completely stable.
float stability = 6;
// Word-specific information for the words recognized by Speech in
// [transcript][google.cloud.dialogflow.cx.v3.StreamingRecognitionResult.transcript].
// Populated if and only if `message_type` = `TRANSCRIPT` and
// [InputAudioConfig.enable_word_info] is set.
repeated SpeechWordInfo speech_word_info = 7;
// Time offset of the end of this Speech recognition result relative to the
// beginning of the audio. Only populated for `message_type` =
// `TRANSCRIPT`.
google.protobuf.Duration speech_end_offset = 8;
// Detected language code for the transcript.
string language_code = 10;
}
// Represents the parameters of a conversational query.
message QueryParameters {
// The time zone of this conversational query from the [time zone
// database](https://www.iana.org/time-zones), e.g., America/New_York,
// Europe/Paris. If not provided, the time zone specified in the agent is
// used.
string time_zone = 1;
// The geo location of this conversational query.
google.type.LatLng geo_location = 2;
// Additional session entity types to replace or extend developer entity types
// with. The entity synonyms apply to all languages and persist for the
// session of this query.
repeated SessionEntityType session_entity_types = 3;
// This field can be used to pass custom data into the webhook associated with
// the agent. Arbitrary JSON objects are supported.
// Some integrations that query a Dialogflow agent may provide additional
// information in the payload.
// In particular, for the Dialogflow Phone Gateway integration, this field has
// the form:
// ```
// {
// "telephony": {
// "caller_id": "+18558363987"
// }
// }
// ```
google.protobuf.Struct payload = 4;
// Additional parameters to be put into [session
// parameters][SessionInfo.parameters]. To remove a
// parameter from the session, clients should explicitly set the parameter
// value to null.
//
// You can reference the session parameters in the agent with the following
// format: $session.params.parameter-id.
//
// Depending on your protocol or client library language, this is a
// map, associative array, symbol table, dictionary, or JSON object
// composed of a collection of (MapKey, MapValue) pairs:
//
// * MapKey type: string
// * MapKey value: parameter name
// * MapValue type: If parameter's entity type is a composite entity then use
// map, otherwise, depending on the parameter value type, it could be one of
// string, number, boolean, null, list or map.
// * MapValue value: If parameter's entity type is a composite entity then use
// map from composite entity property names to property values, otherwise,
// use parameter value.
google.protobuf.Struct parameters = 5;
// The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to
// override the [current page][QueryResult.current_page] in the session.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/flows/<Flow ID>/pages/<Page ID>`.
//
// If `current_page` is specified, the previous state of the session will be
// ignored by Dialogflow, including the [previous
// page][QueryResult.current_page] and the [previous session
// parameters][QueryResult.parameters].
// In most cases,
// [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page]
// and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters]
// should be configured together to direct a session to a specific state.
string current_page = 6 [
(google.api.resource_reference) = { type: "dialogflow.googleapis.com/Page" }
];
// Whether to disable webhook calls for this request.
bool disable_webhook = 7;
// Configures whether sentiment analysis should be performed. If not
// provided, sentiment analysis is not performed.
bool analyze_query_text_sentiment = 8;
// This field can be used to pass HTTP headers for a webhook
// call. These headers will be sent to webhook along with the headers that
// have been configured through Dialogflow web console. The headers defined
// within this field will overwrite the headers configured through Dialogflow
// console if there is a conflict. Header names are case-insensitive.
// Google's specified headers are not allowed. Including: "Host",
// "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
// "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
map<string, string> webhook_headers = 10;
// A list of flow versions to override for the request.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/flows/<Flow ID>/versions/<Version ID>`.
//
// If version 1 of flow X is included in this list, the traffic of
// flow X will go through version 1 regardless of the version configuration in
// the environment. Each flow can have at most one version specified in this
// list.
repeated string flow_versions = 14 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Version"
}];
// The channel which this query is for.
//
// If specified, only the
// [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated
// with the channel will be returned. If no
// [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is
// associated with the channel, it falls back to the
// [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with
// unspecified channel.
//
// If unspecified, the
// [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with
// unspecified channel will be returned.
string channel = 15;
// Optional. Sets Dialogflow session life time.
// By default, a Dialogflow session remains active and its data is stored for
// 30 minutes after the last request is sent for the session.
// This value should be no longer than 1 day.
google.protobuf.Duration session_ttl = 16
[(google.api.field_behavior) = OPTIONAL];
// Optional. Information about the end-user to improve the relevance and
// accuracy of generative answers.
//
// This will be interpreted and used by a language model, so, for good
// results, the data should be self-descriptive, and in a simple structure.
//
// Example:
//
// ```json
// {
// "subscription plan": "Business Premium Plus",
// "devices owned": [
// {"model": "Google Pixel 7"},
// {"model": "Google Pixel Tablet"}
// ]
// }
// ```
google.protobuf.Struct end_user_metadata = 18
[(google.api.field_behavior) = OPTIONAL];
// Optional. Search configuration for UCS search queries.
SearchConfig search_config = 20 [(google.api.field_behavior) = OPTIONAL];
}
// Search configuration for UCS search queries.
message SearchConfig {
// Optional. Boosting configuration for the datastores.
repeated BoostSpecs boost_specs = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. Filter configuration for the datastores.
repeated FilterSpecs filter_specs = 2
[(google.api.field_behavior) = OPTIONAL];
}
// Boost specification to boost certain documents.
// A copy of google.cloud.discoveryengine.v1main.BoostSpec, field documentation
// is available at
// https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/BoostSpec
message BoostSpec {
// Boost applies to documents which match a condition.
message ConditionBoostSpec {
// Optional. An expression which specifies a boost condition. The syntax and
// supported fields are the same as a filter expression.
// Examples:
//
// * To boost documents with document ID "doc_1" or "doc_2", and
// color
// "Red" or "Blue":
// * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
string condition = 1 [(google.api.field_behavior) = OPTIONAL];
// Optional. Strength of the condition boost, which should be in [-1, 1].
// Negative boost means demotion. Default is 0.0.
//
// Setting to 1.0 gives the document a big promotion. However, it does not
// necessarily mean that the boosted document will be the top result at
// all times, nor that other documents will be excluded. Results could
// still be shown even when none of them matches the condition. And
// results that are significantly more relevant to the search query can
// still trump your heavily favored but irrelevant documents.
//
// Setting to -1.0 gives the document a big demotion. However, results
// that are deeply relevant might still be shown. The document will have
// an upstream battle to get a fairly high ranking, but it is not blocked
// out completely.
//
// Setting to 0.0 means no boost applied. The boosting condition is
// ignored.
float boost = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Optional. Condition boost specifications. If a document matches multiple
// conditions in the specifictions, boost scores from these specifications are
// all applied and combined in a non-linear way. Maximum number of
// specifications is 20.
repeated ConditionBoostSpec condition_boost_specs = 1
[(google.api.field_behavior) = OPTIONAL];
}
// Boost specifications for data stores.
message BoostSpecs {
// Optional. Data Stores where the boosting configuration is applied. The full
// names of the referenced data stores. Formats:
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
// `projects/{project}/locations/{location}/dataStores/{data_store}
repeated string data_stores = 1 [
(google.api.field_behavior) = OPTIONAL,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/DataStore"
}
];
// Optional. A list of boosting specifications.
repeated BoostSpec spec = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Filter specifications for data stores.
message FilterSpecs {
// Optional. Data Stores where the boosting configuration is applied. The full
// names of the referenced data stores. Formats:
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
// `projects/{project}/locations/{location}/dataStores/{data_store}
repeated string data_stores = 1 [
(google.api.field_behavior) = OPTIONAL,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/DataStore"
}
];
// Optional. The filter expression to be applied.
// Expression syntax is documented at
// https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Represents the query input. It can contain one of:
//
// 1. A conversational query in the form of text.
//
// 2. An intent query that specifies which intent to trigger.
//
// 3. Natural language speech audio to be processed.
//
// 4. An event to be triggered.
//
// 5. DTMF digits to invoke an intent and fill in parameter value.
message QueryInput {
// Required. The input specification.
oneof input {
// The natural language text to be processed.
TextInput text = 2;
// The intent to be triggered.
IntentInput intent = 3;
// The natural language speech audio to be processed.
AudioInput audio = 5;
// The event to be triggered.
EventInput event = 6;
// The DTMF event to be handled.
DtmfInput dtmf = 7;
}
// Required. The language of the input. See [Language
// Support](https://cloud.google.com/dialogflow/cx/docs/reference/language)
// for a list of the currently supported language codes. Note that queries in
// the same session do not necessarily need to specify the same language.
string language_code = 4 [(google.api.field_behavior) = REQUIRED];
}
// Represents the result of a conversational query.
message QueryResult {
// The original conversational query.
oneof query {
// If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was
// provided as input, this field will contain a copy of the text.
string text = 1;
// If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as
// input, this field will contain a copy of the intent identifier. Format:
// `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/intents/<Intent ID>`.
string trigger_intent = 11 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Intent"
}];
// If [natural language speech
// audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input,
// this field will contain the transcript for the audio.
string transcript = 12;
// If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as
// input, this field will contain the name of the event.
string trigger_event = 14;
// If a [DTMF][google.cloud.dialogflow.cx.v3.DtmfInput] was provided as
// input, this field will contain a copy of the
// [DtmfInput][google.cloud.dialogflow.cx.v3.DtmfInput].
DtmfInput dtmf = 23;
}
// The language that was triggered during intent detection.
// See [Language
// Support](https://cloud.google.com/dialogflow/cx/docs/reference/language)
// for a list of the currently supported language codes.
string language_code = 2;
// The collected [session
// parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters].
//
// Depending on your protocol or client library language, this is a
// map, associative array, symbol table, dictionary, or JSON object
// composed of a collection of (MapKey, MapValue) pairs:
//
// * MapKey type: string
// * MapKey value: parameter name
// * MapValue type: If parameter's entity type is a composite entity then use
// map, otherwise, depending on the parameter value type, it could be one of
// string, number, boolean, null, list or map.
// * MapValue value: If parameter's entity type is a composite entity then use
// map from composite entity property names to property values, otherwise,
// use parameter value.
google.protobuf.Struct parameters = 3;
// The list of rich messages returned to the client. Responses vary from
// simple text messages to more sophisticated, structured payloads used
// to drive complex logic.
repeated ResponseMessage response_messages = 4;
// The list of webhook call status in the order of call sequence.
repeated google.rpc.Status webhook_statuses = 13;
// The list of webhook payload in
// [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload],
// in the order of call sequence. If some webhook call fails or doesn't return
// any payload, an empty `Struct` would be used instead.
repeated google.protobuf.Struct webhook_payloads = 6;
// The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all
// fields are filled in this message, including but not limited to `name` and
// `display_name`.
Page current_page = 7;
// The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the
// conversational query. Some, not all fields are filled in this message,
// including but not limited to: `name` and `display_name`. This field is
// deprecated, please use
// [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match]
// instead.
Intent intent = 8 [deprecated = true];
// The intent detection confidence. Values range from 0.0 (completely
// uncertain) to 1.0 (completely certain).
// This value is for informational purpose only and is only used to
// help match the best intent within the classification threshold.
// This value may change for the same end-user expression at any time due to a
// model retraining or change in implementation.
// This field is deprecated, please use
// [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match]
// instead.
float intent_detection_confidence = 9 [deprecated = true];
// Intent match result, could be an intent or an event.
Match match = 15;
// The free-form diagnostic info. For example, this field could contain
// webhook call latency. The fields of this data can change without notice,
// so you should not write code that depends on its structure.
//
// One of the fields is called "Alternative Matched Intents", which may
// aid with debugging. The following describes these intent results:
//
// - The list is empty if no intent was matched to end-user input.
// - Only intents that are referenced in the currently active flow are
// included.
// - The matched intent is included.
// - Other intents that could have matched end-user input, but did not match
// because they are referenced by intent routes that are out of
// [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope),
// are included.
// - Other intents referenced by intent routes in scope that matched end-user
// input, but had a lower confidence score.
google.protobuf.Struct diagnostic_info = 10;
// The sentiment analyss result, which depends on
// [`analyze_query_text_sentiment`]
// [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment],
// specified in the request.
SentimentAnalysisResult sentiment_analysis_result = 17;
// Returns the current advanced settings including IVR settings. Even though
// the operations configured by these settings are performed by Dialogflow,
// the client may need to perform special logic at the moment. For example, if
// Dialogflow exports audio to Google Cloud Storage, then the client may need
// to wait for the resulting object to appear in the bucket before proceeding.
AdvancedSettings advanced_settings = 21;
// Indicates whether the Thumbs up/Thumbs down rating controls are need to be
// shown for the response in the Dialogflow Messenger widget.
bool allow_answer_feedback = 32;
}
// Represents the natural language text to be processed.
message TextInput {
// Required. The UTF-8 encoded natural language text to be processed. Text
// length must not exceed 256 characters.
string text = 1 [(google.api.field_behavior) = REQUIRED];
}
// Represents the intent to trigger programmatically rather than as a result of
// natural language processing.
message IntentInput {
// Required. The unique identifier of the intent.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/intents/<Intent ID>`.
string intent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Intent"
}
];
}
// Represents the natural speech audio to be processed.
message AudioInput {
// Required. Instructs the speech recognizer how to process the speech audio.
InputAudioConfig config = 1 [(google.api.field_behavior) = REQUIRED];
// The natural language speech audio to be processed.
// A single request can contain up to 2 minutes of speech audio data.