Skip to content

Commit aee4464

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add new RPC IngestContextReferences, GenerateSuggestions
docs: clarified wording around phrase_sets PiperOrigin-RevId: 734249550
1 parent 263055c commit aee4464

5 files changed

Lines changed: 252 additions & 0 deletions

File tree

google/cloud/dialogflow/v2beta1/audio_config.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ message SpeechToTextConfig {
347347
string model = 2;
348348

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

google/cloud/dialogflow/v2beta1/conversation.proto

Lines changed: 152 additions & 0 deletions
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: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}:ingestContextReferences"
126+
body: "*"
127+
};
128+
option (google.api.method_signature) = "conversation,context_references";
129+
}
130+
120131
// Batch ingests messages to conversation. Customers can use this RPC to
121132
// ingest historical messages to conversation.
122133
rpc BatchCreateMessages(BatchCreateMessagesRequest)
@@ -207,6 +218,22 @@ service Conversations {
207218
}
208219
};
209220
}
221+
222+
// Generates all the suggestions using generators configured in the
223+
// conversation profile. A generator is used only if its trigger event is
224+
// matched.
225+
rpc GenerateSuggestions(GenerateSuggestionsRequest)
226+
returns (GenerateSuggestionsResponse) {
227+
option (google.api.http) = {
228+
post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:generate"
229+
body: "*"
230+
additional_bindings {
231+
post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:generate"
232+
body: "*"
233+
}
234+
};
235+
option (google.api.method_signature) = "conversation";
236+
}
210237
}
211238

212239
// Represents a conversation.
@@ -288,6 +315,62 @@ message Conversation {
288315
[(google.api.field_behavior) = OUTPUT_ONLY];
289316
}
290317

318+
// Represents a piece of ingested context information.
319+
message ContextReference {
320+
// Contents ingested.
321+
message ContextContent {
322+
// Represents the format of the ingested string.
323+
enum ContentFormat {
324+
// Unspecified content format.
325+
CONTENT_FORMAT_UNSPECIFIED = 0;
326+
327+
// Content was provided in JSON format.
328+
JSON = 1;
329+
330+
// Content was provided as plain text.
331+
PLAIN_TEXT = 2;
332+
}
333+
334+
// Required. The information ingested in a single request.
335+
string content = 1 [(google.api.field_behavior) = REQUIRED];
336+
337+
// Required. The format of the ingested string.
338+
ContentFormat content_format = 2 [(google.api.field_behavior) = REQUIRED];
339+
340+
// Output only. The time when this information was incorporated into the
341+
// relevant context reference.
342+
google.protobuf.Timestamp ingestion_time = 3
343+
[(google.api.field_behavior) = OUTPUT_ONLY];
344+
}
345+
346+
// Represents the mode in which context reference contents are updated.
347+
enum UpdateMode {
348+
// Unspecified update mode.
349+
UPDATE_MODE_UNSPECIFIED = 0;
350+
351+
// Context content updates are applied in append mode.
352+
APPEND = 1;
353+
354+
// Context content updates are applied in overwrite mode.
355+
OVERWRITE = 2;
356+
}
357+
358+
// Required. The list of content updates for a context reference.
359+
repeated ContextContent context_contents = 1
360+
[(google.api.field_behavior) = REQUIRED];
361+
362+
// Required. The mode in which context reference contents are updated.
363+
UpdateMode update_mode = 2 [(google.api.field_behavior) = REQUIRED];
364+
365+
// Optional. The language of the information ingested, defaults to "en-US"
366+
// if not set.
367+
string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
368+
369+
// Output only. The time the context reference was first created.
370+
google.protobuf.Timestamp create_time = 4
371+
[(google.api.field_behavior) = OUTPUT_ONLY];
372+
}
373+
291374
// Output only. Identifier. The unique identifier of this conversation.
292375
// Format: `projects/<Project ID>/locations/<Location
293376
// ID>/conversations/<Conversation ID>`.
@@ -346,6 +429,10 @@ message Conversation {
346429
// Output only. The telephony connection information.
347430
TelephonyConnectionInfo telephony_connection_info = 10
348431
[(google.api.field_behavior) = OUTPUT_ONLY];
432+
433+
// Output only. The context reference updates provided by external systems.
434+
map<string, ContextReference> ingested_context_references = 17
435+
[(google.api.field_behavior) = OUTPUT_ONLY];
349436
}
350437

351438
// Represents a phone number for telephony integration. It allows for connecting
@@ -545,6 +632,32 @@ message ListMessagesResponse {
545632
string next_page_token = 2;
546633
}
547634

635+
// The request message for [ConversationsService.IngestContextReferences][].
636+
message IngestContextReferencesRequest {
637+
// Required. Resource identifier of the conversation to ingest context
638+
// information for. Format: `projects/<Project ID>/locations/<Location
639+
// ID>/conversations/<Conversation ID>`.
640+
string conversation = 1 [
641+
(google.api.field_behavior) = REQUIRED,
642+
(google.api.resource_reference) = {
643+
type: "dialogflow.googleapis.com/Conversation"
644+
}
645+
];
646+
647+
// Required. The context references to ingest. The key is the name of the
648+
// context reference and the value contains the contents of the context
649+
// reference. The key is used to incorporate ingested context references to
650+
// enhance the generator.
651+
map<string, Conversation.ContextReference> context_references = 2
652+
[(google.api.field_behavior) = REQUIRED];
653+
}
654+
655+
// The response message for [ConversationsService.IngestContextReferences][].
656+
message IngestContextReferencesResponse {
657+
// All context references ingested.
658+
map<string, Conversation.ContextReference> ingested_context_references = 1;
659+
}
660+
548661
// The request message for
549662
// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary].
550663
message SuggestConversationSummaryRequest {
@@ -734,6 +847,13 @@ message GenerateStatelessSuggestionRequest {
734847
string generator_name = 3;
735848
}
736849

850+
// Optional. A section of ingested context information. The key is the name of
851+
// the context reference and the value contains the contents of the context
852+
// reference. The key is used to incorporate ingested context references to
853+
// enhance the generator.
854+
map<string, Conversation.ContextReference> context_references = 4
855+
[(google.api.field_behavior) = OPTIONAL];
856+
737857
// Optional. Context of the conversation, including transcripts.
738858
ConversationContext conversation_context = 5
739859
[(google.api.field_behavior) = OPTIONAL];
@@ -1092,3 +1212,35 @@ message SearchKnowledgeAnswer {
10921212
type: "dialogflow.googleapis.com/AnswerRecord"
10931213
}];
10941214
}
1215+
1216+
// The request message for
1217+
// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2beta1.Conversations.GenerateSuggestions].
1218+
message GenerateSuggestionsRequest {
1219+
// Required. The conversation for which the suggestions are generated. Format:
1220+
// `projects/<Project ID>/locations/<Location
1221+
// ID>/conversations/<Conversation ID>`.
1222+
//
1223+
// The conversation must be created with a conversation profile which has
1224+
// generators configured in it to be able to get suggestions.
1225+
string conversation = 1 [
1226+
(google.api.field_behavior) = REQUIRED,
1227+
(google.api.resource_reference) = {
1228+
type: "dialogflow.googleapis.com/Conversation"
1229+
}
1230+
];
1231+
1232+
// Optional. The name of the latest conversation message for which the request
1233+
// is triggered. Format: `projects/<Project ID>/locations/<Location
1234+
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
1235+
string latest_message = 2 [
1236+
(google.api.field_behavior) = OPTIONAL,
1237+
(google.api.resource_reference) = {
1238+
type: "dialogflow.googleapis.com/Message"
1239+
}
1240+
];
1241+
1242+
// Optional. A list of trigger events. Only generators configured in the
1243+
// conversation_profile whose trigger_event is listed here will be triggered.
1244+
repeated TriggerEvent trigger_events = 3
1245+
[(google.api.field_behavior) = OPTIONAL];
1246+
}

google/cloud/dialogflow/v2beta1/dialogflow_grpc_service_config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,21 @@
205205
}
206206
],
207207
"timeout": "600s"
208+
},
209+
{
210+
"name": [
211+
{
212+
"service": "google.cloud.dialogflow.v2beta1.Participants",
213+
"method": "BidiStreamingAnalyzeContent"
214+
}
215+
],
216+
"timeout": "900s",
217+
"retryPolicy": {
218+
"initialBackoff": "0.100s",
219+
"maxBackoff": "60s",
220+
"backoffMultiplier": 1.3,
221+
"retryableStatusCodes": []
222+
}
208223
}
209224
]
210225
}

google/cloud/dialogflow/v2beta1/generator.proto

Lines changed: 45 additions & 0 deletions
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 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/v2beta1/participant.proto

Lines changed: 38 additions & 0 deletions
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/v2beta1/audio_config.proto";
24+
import "google/cloud/dialogflow/v2beta1/generator.proto";
2425
import "google/cloud/dialogflow/v2beta1/session.proto";
2526
import "google/protobuf/field_mask.proto";
2627
import "google/protobuf/struct.proto";
@@ -1251,6 +1252,10 @@ message SuggestionResult {
12511252

12521253
// SuggestDialogflowAssistsResponse if request is for ENTITY_EXTRACTION.
12531254
SuggestDialogflowAssistsResponse suggest_entity_extraction_response = 7;
1255+
1256+
// Suggestions generated using generators triggered by customer or agent
1257+
// messages.
1258+
GenerateSuggestionsResponse generate_suggestions_response = 9;
12541259
}
12551260
}
12561261

@@ -1428,6 +1433,39 @@ message SuggestSmartRepliesResponse {
14281433
int32 context_size = 3;
14291434
}
14301435

1436+
// The response message for
1437+
// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2beta1.Conversations.GenerateSuggestions].
1438+
message GenerateSuggestionsResponse {
1439+
// A GeneratorSuggestion answer.
1440+
message GeneratorSuggestionAnswer {
1441+
// Suggestion details.
1442+
GeneratorSuggestion generator_suggestion = 1;
1443+
1444+
// The name of the generator used to generate this suggestion. Format:
1445+
// `projects/<Project ID>/locations/<Location ID>/generators/<Generator
1446+
// ID>`.
1447+
string source_generator = 2;
1448+
1449+
// Answer record that uniquely identifies the suggestion. This can be used
1450+
// to provide suggestion feedback.
1451+
string answer_record = 3 [(google.api.resource_reference) = {
1452+
type: "dialogflow.googleapis.com/AnswerRecord"
1453+
}];
1454+
}
1455+
1456+
// The answers generated for the conversation based on context.
1457+
repeated GeneratorSuggestionAnswer generator_suggestion_answers = 1;
1458+
1459+
// The name of the latest conversation message used as context for
1460+
// compiling suggestion.
1461+
//
1462+
// Format: `projects/<Project ID>/locations/<Location
1463+
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
1464+
string latest_message = 2 [(google.api.resource_reference) = {
1465+
type: "dialogflow.googleapis.com/Message"
1466+
}];
1467+
}
1468+
14311469
// The response message for
14321470
// [Participants.SuggestDialogflowAssists][google.cloud.dialogflow.v2beta1.Participants.SuggestDialogflowAssists].
14331471
message SuggestDialogflowAssistsResponse {

0 commit comments

Comments
 (0)