@@ -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].
490603message 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+ }
0 commit comments