Skip to content

Commit

Permalink
feat: Add Agent Assist Summarization API (https://cloud.google.com/ag…
Browse files Browse the repository at this point in the history
…ent-assist/docs/summarization) (#1002)

* fix: revert removal of LRO mixin

PiperOrigin-RevId: 476177109

Source-Link: googleapis/googleapis@652c4c1

Source-Link: googleapis/googleapis-gen@92d0bfe
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTJkMGJmZTI0MDZlODI4NWNkNDE2MjU0ZGY0NWQ4MmZlYWM2ODc5ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: override API mixins when needed

PiperOrigin-RevId: 477248447

Source-Link: googleapis/googleapis@4689c73

Source-Link: googleapis/googleapis-gen@c405978
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQwNTk3ODZhNWNkODA1YTAxNTFkOTViNDc3ZmJjNDg2YmNiY2VkYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Add Agent Assist Summarization API (https://cloud.google.com/agent-assist/docs/summarization)
docs: clarify SuggestionFeature enums which are specific to chat agents

PiperOrigin-RevId: 477479918

Source-Link: googleapis/googleapis@6deca98

Source-Link: googleapis/googleapis-gen@b23d242
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjIzZDI0MmM1YzVkZWI3Y2U2ZjRhN2Y3MTg2MmEzMTE1NTUwNjliZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: applied owl-bot transformations manually

* fix: lint

* fix: revert some changes

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Fenster <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2022
1 parent 89d1fd4 commit eb5830e
Show file tree
Hide file tree
Showing 49 changed files with 12,482 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,21 @@ service Conversations {
};
option (google.api.method_signature) = "parent";
}

// Suggest summary for a conversation based on specific historical messages.
// The range of the messages to be used for summary can be specified in the
// request.
rpc SuggestConversationSummary(SuggestConversationSummaryRequest) returns (SuggestConversationSummaryResponse) {
option (google.api.http) = {
post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary"
body: "*"
additional_bindings {
post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary"
body: "*"
}
};
option (google.api.method_signature) = "conversation";
}
}

// Represents a conversation.
Expand Down Expand Up @@ -411,3 +426,69 @@ message ListMessagesResponse {
// no more results in the list.
string next_page_token = 2;
}

// The request message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary].
message SuggestConversationSummaryRequest {
// Required. The conversation to fetch suggestion for.
// Format: `projects/<Project ID>/locations/<Location
// ID>/conversations/<Conversation ID>`.
string conversation = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Conversation"
}
];

// The name of the latest conversation message used as context for
// compiling suggestion. If empty, the latest message of the conversation will
// be used.
//
// Format: `projects/<Project ID>/locations/<Location
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
string latest_message = 3 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Message"
}];

// Max number of messages prior to and including
// [latest_message] to use as context when compiling the
// suggestion. By default 500 and at most 1000.
int32 context_size = 4;
}

// The response message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary].
message SuggestConversationSummaryResponse {
// Generated summary for a conversation.
message Summary {
// The summary content that is concatenated into one string.
string text = 1;

// The summary content that is divided into sections. The key is the
// section's name and the value is the section's content. There is no
// specific format for the key or value.
map<string, string> text_sections = 4;

// The name of the answer record. Format:
// "projects/<Project ID>/answerRecords/<Answer Record ID>"
string answer_record = 3 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/AnswerRecord"
}];
}

// Generated summary.
Summary summary = 1;

// The name of the latest conversation message used as context for
// compiling suggestion.
//
// Format: `projects/<Project ID>/locations/<Location
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
string latest_message = 2 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Message"
}];

// Number of messages prior to and including
// [last_conversation_message][] used to compile the suggestion. It may be
// smaller than the [SuggestSummaryRequest.context_size][] field in the
// request if there weren't that many messages in the conversation.
int32 context_size = 3;
}
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,17 @@ message SuggestionFeature {
// Unspecified feature type.
TYPE_UNSPECIFIED = 0;

// Run article suggestion model.
// Run article suggestion model for chat.
ARTICLE_SUGGESTION = 1;

// Run FAQ model.
FAQ = 2;

// Run smart reply model.
// Run smart reply model for chat.
SMART_REPLY = 3;

// Run conversation summarization model for chat.
CONVERSATION_SUMMARIZATION = 8;
}

// Type of Human Agent Assistant API feature to request.
Expand Down
354 changes: 353 additions & 1 deletion packages/google-cloud-dialogflow/protos/protos.d.ts

Large diffs are not rendered by default.

846 changes: 846 additions & 0 deletions packages/google-cloud-dialogflow/protos/protos.js

Large diffs are not rendered by default.

93 changes: 92 additions & 1 deletion packages/google-cloud-dialogflow/protos/protos.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright 2022 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
//
// https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(conversation) {
// [START dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async]
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The conversation to fetch suggestion for.
* Format: `projects/<Project ID>/locations/<Location
* ID>/conversations/<Conversation ID>`.
*/
// const conversation = 'abc123'
/**
* The name of the latest conversation message used as context for
* compiling suggestion. If empty, the latest message of the conversation will
* be used.
* Format: `projects/<Project ID>/locations/<Location
* ID>/conversations/<Conversation ID>/messages/<Message ID>`.
*/
// const latestMessage = 'abc123'
/**
* Max number of messages prior to and including
* latest_message to use as context when compiling the
* suggestion. By default 500 and at most 1000.
*/
// const contextSize = 1234

// Imports the Dialogflow library
const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1;

// Instantiates a client
const dialogflowClient = new ConversationsClient();

async function callSuggestConversationSummary() {
// Construct request
const request = {
conversation,
};

// Run request
const response = await dialogflowClient.suggestConversationSummary(request);
console.log(response);
}

callSuggestConversationSummary();
// [END dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,54 @@
}
}
},
{
"regionTag": "dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async",
"title": "dialogflow suggestConversationSummary Sample",
"origin": "API_DEFINITION",
"description": " Suggest summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.",
"canonical": true,
"file": "conversations.suggest_conversation_summary.js",
"language": "JAVASCRIPT",
"segments": [
{
"start": 25,
"end": 69,
"type": "FULL"
}
],
"clientMethod": {
"shortName": "SuggestConversationSummary",
"fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary",
"async": true,
"parameters": [
{
"name": "conversation",
"type": "TYPE_STRING"
},
{
"name": "latest_message",
"type": "TYPE_STRING"
},
{
"name": "context_size",
"type": "TYPE_INT32"
}
],
"resultType": ".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse",
"client": {
"shortName": "ConversationsClient",
"fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient"
},
"method": {
"shortName": "SuggestConversationSummary",
"fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary",
"service": {
"shortName": "Conversations",
"fullName": "google.cloud.dialogflow.v2beta1.Conversations"
}
}
}
},
{
"regionTag": "dialogflow_v2beta1_generated_Documents_ListDocuments_async",
"title": "dialogflow listDocuments Sample",
Expand Down
Loading

0 comments on commit eb5830e

Please sign in to comment.