Skip to content

Commit c57048e

Browse files
Google APIscopybara-github
Google APIs
authored andcommitted
feat: Add new RPC IngestContextReferences, GenerateSuggestions
docs: clarified wording around phrase_sets PiperOrigin-RevId: 733912069
1 parent 783d7e0 commit c57048e

File tree

4 files changed

+237
-0
lines changed

4 files changed

+237
-0
lines changed

google/cloud/dialogflow/v2/audio_config.proto

+2
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ message SpeechToTextConfig {
292292
string model = 2;
293293

294294
// List of names of Cloud Speech phrase sets that are used for transcription.
295+
// For phrase set limitations, please refer to [Cloud Speech API quotas and
296+
// limits](https://cloud.google.com/speech-to-text/quotas#content).
295297
repeated string phrase_sets = 4 [(google.api.resource_reference) = {
296298
type: "speech.googleapis.com/PhraseSet"
297299
}];

google/cloud/dialogflow/v2/conversation.proto

+152
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ service Conversations {
117117
option (google.api.method_signature) = "name";
118118
}
119119

120+
// Data ingestion API.
121+
// Ingests context references for an existing conversation.
122+
rpc IngestContextReferences(IngestContextReferencesRequest)
123+
returns (IngestContextReferencesResponse) {
124+
option (google.api.http) = {
125+
post: "/v2/{conversation=projects/*/locations/*/conversations/*}:ingestContextReferences"
126+
body: "*"
127+
};
128+
option (google.api.method_signature) = "conversation,context_references";
129+
}
130+
120131
// Lists messages that belong to a given conversation.
121132
// `messages` are ordered by `create_time` in descending order. To fetch
122133
// updates without duplication, send request with filter
@@ -192,6 +203,22 @@ service Conversations {
192203
}
193204
};
194205
}
206+
207+
// Generates all the suggestions using generators configured in the
208+
// conversation profile. A generator is used only if its trigger event is
209+
// matched.
210+
rpc GenerateSuggestions(GenerateSuggestionsRequest)
211+
returns (GenerateSuggestionsResponse) {
212+
option (google.api.http) = {
213+
post: "/v2/{conversation=projects/*/conversations/*}/suggestions:generate"
214+
body: "*"
215+
additional_bindings {
216+
post: "/v2/{conversation=projects/*/locations/*/conversations/*}/suggestions:generate"
217+
body: "*"
218+
}
219+
};
220+
option (google.api.method_signature) = "conversation";
221+
}
195222
}
196223

197224
// Represents a conversation.
@@ -273,6 +300,62 @@ message Conversation {
273300
[(google.api.field_behavior) = OUTPUT_ONLY];
274301
}
275302

303+
// Represents a section of ingested context information.
304+
message ContextReference {
305+
// Contents ingested.
306+
message ContextContent {
307+
// Represents the format of the ingested string.
308+
enum ContentFormat {
309+
// Unspecified content format.
310+
CONTENT_FORMAT_UNSPECIFIED = 0;
311+
312+
// Content was provided in JSON format.
313+
JSON = 1;
314+
315+
// Content was provided as plain text.
316+
PLAIN_TEXT = 2;
317+
}
318+
319+
// Required. The information ingested in a single request.
320+
string content = 1 [(google.api.field_behavior) = REQUIRED];
321+
322+
// Required. The format of the ingested string.
323+
ContentFormat content_format = 2 [(google.api.field_behavior) = REQUIRED];
324+
325+
// Output only. The time when this information was incorporated into the
326+
// relevant context reference.
327+
google.protobuf.Timestamp ingestion_time = 3
328+
[(google.api.field_behavior) = OUTPUT_ONLY];
329+
}
330+
331+
// Represents the mode in which context reference contents are updated.
332+
enum UpdateMode {
333+
// Unspecified update mode.
334+
UPDATE_MODE_UNSPECIFIED = 0;
335+
336+
// Context content updates are applied in append mode.
337+
APPEND = 1;
338+
339+
// Context content updates are applied in overwrite mode.
340+
OVERWRITE = 2;
341+
}
342+
343+
// Required. The list of content updates for a context reference.
344+
repeated ContextContent context_contents = 1
345+
[(google.api.field_behavior) = REQUIRED];
346+
347+
// Required. The mode in which context reference contents are updated.
348+
UpdateMode update_mode = 2 [(google.api.field_behavior) = REQUIRED];
349+
350+
// Optional. The language of the information ingested, defaults to "en-US"
351+
// if not set.
352+
string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
353+
354+
// Output only. The time the context reference was first created.
355+
google.protobuf.Timestamp create_time = 4
356+
[(google.api.field_behavior) = OUTPUT_ONLY];
357+
}
358+
276359
// Output only. Identifier. The unique identifier of this conversation.
277360
// Format: `projects/<Project ID>/locations/<Location
278361
// ID>/conversations/<Conversation ID>`.
@@ -331,6 +414,10 @@ message Conversation {
331414
// Output only. The telephony connection information.
332415
TelephonyConnectionInfo telephony_connection_info = 10
333416
[(google.api.field_behavior) = OUTPUT_ONLY];
417+
418+
// Output only. The context reference updates provided by external systems.
419+
map<string, ContextReference> ingested_context_references = 17
420+
[(google.api.field_behavior) = OUTPUT_ONLY];
334421
}
335422

336423
// The request message for
@@ -485,6 +572,32 @@ message ConversationPhoneNumber {
485572
string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
486573
}
487574

575+
// The request message for [ConversationsService.IngestContextReferences][].
576+
message IngestContextReferencesRequest {
577+
// Required. Resource identifier of the conversation to ingest context
578+
// information for. Format: `projects/<Project ID>/locations/<Location
579+
// ID>/conversations/<Conversation ID>`.
580+
string conversation = 1 [
581+
(google.api.field_behavior) = REQUIRED,
582+
(google.api.resource_reference) = {
583+
type: "dialogflow.googleapis.com/Conversation"
584+
}
585+
];
586+
587+
// Required. The context references to ingest. The key is the name of the
588+
// context reference and the value contains the contents of the context
589+
// reference. The key is used to incorporate ingested context references to
590+
// enhance the generator.
591+
map<string, Conversation.ContextReference> context_references = 2
592+
[(google.api.field_behavior) = REQUIRED];
593+
}
594+
595+
// The response message for [ConversationsService.IngestContextReferences][].
596+
message IngestContextReferencesResponse {
597+
// All context references ingested.
598+
map<string, Conversation.ContextReference> ingested_context_references = 1;
599+
}
600+
488601
// The request message for
489602
// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
490603
message SuggestConversationSummaryRequest {
@@ -678,6 +791,13 @@ message GenerateStatelessSuggestionRequest {
678791
string generator_name = 3;
679792
}
680793

794+
// Optional. A section of ingested context information. The key is the name of
795+
// the context reference and the value contains the contents of the context
796+
// reference. The key is used to incorporate ingested context references to
797+
// enhance the generator.
798+
map<string, Conversation.ContextReference> context_references = 4
799+
[(google.api.field_behavior) = OPTIONAL];
800+
681801
// Optional. Context of the conversation, including transcripts.
682802
ConversationContext conversation_context = 5
683803
[(google.api.field_behavior) = OPTIONAL];
@@ -1036,3 +1156,35 @@ message SearchKnowledgeAnswer {
10361156
type: "dialogflow.googleapis.com/AnswerRecord"
10371157
}];
10381158
}
1159+
1160+
// The request message for
1161+
// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2.Conversations.GenerateSuggestions].
1162+
message GenerateSuggestionsRequest {
1163+
// Required. The conversation for which the suggestions are generated. Format:
1164+
// `projects/<Project ID>/locations/<Location
1165+
// ID>/conversations/<Conversation ID>`.
1166+
//
1167+
// The conversation must be created with a conversation profile which has
1168+
// generators configured in it to be able to get suggestions.
1169+
string conversation = 1 [
1170+
(google.api.field_behavior) = REQUIRED,
1171+
(google.api.resource_reference) = {
1172+
type: "dialogflow.googleapis.com/Conversation"
1173+
}
1174+
];
1175+
1176+
// Optional. The name of the latest conversation message for which the request
1177+
// is triggered. Format: `projects/<Project ID>/locations/<Location
1178+
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
1179+
string latest_message = 2 [
1180+
(google.api.field_behavior) = OPTIONAL,
1181+
(google.api.resource_reference) = {
1182+
type: "dialogflow.googleapis.com/Message"
1183+
}
1184+
];
1185+
1186+
// Optional. A list of trigger events. Only generators configured in the
1187+
// conversation_profile whose trigger_event is listed here will be triggered.
1188+
repeated TriggerEvent trigger_events = 3
1189+
[(google.api.field_behavior) = OPTIONAL];
1190+
}

google/cloud/dialogflow/v2/generator.proto

+45
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ message SummarizationSection {
320320

321321
// Customer defined sections.
322322
CUSTOMER_DEFINED = 7;
323+
324+
// Concise version of the situation section. This type is only available if
325+
// type SITUATION is not selected.
326+
SITUATION_CONCISE = 9;
327+
328+
// Concise version of the action section. This type is only available if
329+
// type ACTION is not selected.
330+
ACTION_CONCISE = 10;
323331
}
324332

325333
// Optional. Name of the section, for example, "situation".
@@ -354,6 +362,12 @@ message SummarizationContext {
354362
string output_language_code = 6 [(google.api.field_behavior) = OPTIONAL];
355363
}
356364

365+
// Free form generator context that customer can configure.
366+
message FreeFormContext {
367+
// Optional. Free form text input to LLM.
368+
string text = 1 [(google.api.field_behavior) = OPTIONAL];
369+
}
370+
357371
// LLM generator.
358372
message Generator {
359373
option (google.api.resource) = {
@@ -375,6 +389,9 @@ message Generator {
375389

376390
// Required. Input context of the generator.
377391
oneof context {
392+
// Input of free from generator to LLM.
393+
FreeFormContext free_form_context = 11;
394+
378395
// Input of prebuilt Summarization feature.
379396
SummarizationContext summarization_context = 13;
380397
}
@@ -387,6 +404,18 @@ message Generator {
387404
// is triggered in a conversation.
388405
TriggerEvent trigger_event = 5 [(google.api.field_behavior) = OPTIONAL];
389406

407+
// The foundation model to use for generating suggestions. If a foundation
408+
// model isn't specified here, a model specifically tuned for the feature
409+
// type (and version when applicable) will be used.
410+
oneof foundation_model {
411+
// Optional. The published Large Language Model name.
412+
// * To use the latest model version, specify the model name without version
413+
// number. Example: `text-bison`
414+
// * To use a stable model version, specify the version number as well.
415+
// Example: `text-bison@002`.
416+
string published_model = 15 [(google.api.field_behavior) = OPTIONAL];
417+
}
418+
390419
// Output only. Creation time of this generator.
391420
google.protobuf.Timestamp create_time = 8
392421
[(google.api.field_behavior) = OUTPUT_ONLY];
@@ -396,6 +425,12 @@ message Generator {
396425
[(google.api.field_behavior) = OUTPUT_ONLY];
397426
}
398427

428+
// Suggestion generated using free form generator.
429+
message FreeFormSuggestion {
430+
// Required. Free form suggestion.
431+
string response = 1 [(google.api.field_behavior) = REQUIRED];
432+
}
433+
399434
// Suggested summary of the conversation.
400435
message SummarySuggestion {
401436
// A component of the generated summary.
@@ -416,6 +451,10 @@ message SummarySuggestion {
416451
message GeneratorSuggestion {
417452
// The suggestion could be one of the many types
418453
oneof suggestion {
454+
// Optional. Free form suggestion.
455+
FreeFormSuggestion free_form_suggestion = 1
456+
[(google.api.field_behavior) = OPTIONAL];
457+
419458
// Optional. Suggested summary.
420459
SummarySuggestion summary_suggestion = 2
421460
[(google.api.field_behavior) = OPTIONAL];
@@ -434,4 +473,10 @@ enum TriggerEvent {
434473
// Conversations.GenerateStatelessSuggestion and
435474
// Conversations.GenerateSuggestions.
436475
MANUAL_CALL = 2;
476+
477+
// Triggers after each customer message only.
478+
CUSTOMER_MESSAGE = 3;
479+
480+
// Triggers after each agent message only.
481+
AGENT_MESSAGE = 4;
437482
}

google/cloud/dialogflow/v2/participant.proto

+38
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
2323
import "google/cloud/dialogflow/v2/audio_config.proto";
24+
import "google/cloud/dialogflow/v2/generator.proto";
2425
import "google/cloud/dialogflow/v2/session.proto";
2526
import "google/protobuf/field_mask.proto";
2627
import "google/protobuf/struct.proto";
@@ -847,6 +848,39 @@ message SuggestFaqAnswersResponse {
847848
int32 context_size = 3;
848849
}
849850

851+
// The response message for
852+
// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2.Conversations.GenerateSuggestions].
853+
message GenerateSuggestionsResponse {
854+
// A GeneratorSuggestion answer.
855+
message GeneratorSuggestionAnswer {
856+
// Suggestion details.
857+
GeneratorSuggestion generator_suggestion = 1;
858+
859+
// The name of the generator used to generate this suggestion. Format:
860+
// `projects/<Project ID>/locations/<Location ID>/generators/<Generator
861+
// ID>`.
862+
string source_generator = 2;
863+
864+
// Answer record that uniquely identifies the suggestion. This can be used
865+
// to provide suggestion feedback.
866+
string answer_record = 3 [(google.api.resource_reference) = {
867+
type: "dialogflow.googleapis.com/AnswerRecord"
868+
}];
869+
}
870+
871+
// The answers generated for the conversation based on context.
872+
repeated GeneratorSuggestionAnswer generator_suggestion_answers = 1;
873+
874+
// The name of the latest conversation message used as context for
875+
// compiling suggestion.
876+
//
877+
// Format: `projects/<Project ID>/locations/<Location
878+
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
879+
string latest_message = 2 [(google.api.resource_reference) = {
880+
type: "dialogflow.googleapis.com/Message"
881+
}];
882+
}
883+
850884
// The request message for
851885
// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies].
852886
message SuggestSmartRepliesRequest {
@@ -1098,6 +1132,10 @@ message SuggestionResult {
10981132

10991133
// SuggestSmartRepliesResponse if request is for SMART_REPLY.
11001134
SuggestSmartRepliesResponse suggest_smart_replies_response = 4;
1135+
1136+
// Suggestions generated using generators triggered by customer or agent
1137+
// messages.
1138+
GenerateSuggestionsResponse generate_suggestions_response = 9;
11011139
}
11021140
}
11031141

0 commit comments

Comments
 (0)