总结注释器会返回客户体验数据分析对话的总结。总结是 Agent Assist 的一项功能,只能与 CX Insights 搭配使用,也可以与您预先存在的 Agent Assist 对话配置文件搭配使用。本页面介绍了如何启用总结注释器。
结算
客户体验分析洞见使用 Agent Assist 生成对话摘要。如果您为客户体验分析实现总结功能,则账单上会多出一项“Agent Assist API 使用情况”。如需了解详情,请参阅 Agent Assist 价格页面。
AnnotatorSelector
与其他分析注释器不同,总结注释器默认处于停用状态。通过将 AnnotatorSelector.run_summarization_annotator 设置为 true 来启用该功能。
如果您在请求中指定了 AnnotatorSelector,CX Insights 会运行明确启用的注释器。如需运行总结以外的注释器,请在请求中启用这些注释器。如需了解可用选项,请参阅 AnnotatorSelector。
前提条件
为您的 Google Cloud 项目启用 Dialogflow API 和 Customer Experience Insights API。
使用 CX 数据洞见分析总结对话
您可以为 CX Insights 对话创建分析,以生成该对话的摘要。如需了解详情,请参阅使用 API 创建和分析对话。创建分析时,系统会使用 annotator selector 启用并配置总结功能。
如需查看每种总结模型支持的语言列表,请参阅 Agent Assist 语言支持文档。
使用生成器摘要模型
Agent Assist 还提供由 LLM 提供支持的自定义部分总结功能,并使用生成器模型。您可以使用包含预定义部分的生成器模型,也可以定义自定义部分。
按照以下步骤操作,使用 LLM 赋能的生成器模型自动生成摘要。
- 按照 Agent Assist 说明创建摘要生成器
- 将
run_summarization_annotator设置为true。 - 将
summarization_config设置为generator。
例如:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{annotator_selector: {run_summarization_annotator: true, summarization_config: {generator: '"projects/PROJECT_ID/locations/global/generators/generator_id"}}}' \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/conversations/CONVERSATION_ID/
查看总结结果
创建分析会返回一个操作 ID。轮询操作以跟踪其进度。分析完成后,查询对话即可查看分析结果。
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/conversations/CONVERSATION_ID"
摘要数据填充在响应中。
- 总结以
runtimeAnnotation的形式存储,并填充conversationSummarizationSuggestion字段。 - 对话的
latestSummary字段已填充。
后续分析会添加新的运行时注释,并覆盖最新的摘要。
{
"name": "projects/694347961123/locations/us-east1/conversations/14849016801257151776",
"createTime": "2023-03-07T23:00:00.243902Z",
"updateTime": "2023-03-07T23:00:01.167050Z",
…
"runtimeAnnotations": [
{
"annotationId": "14849016801257150641",
"createTime": "2023-03-07T23:00:01.167050Z",
"conversationSummarizationSuggestion": {
"text": "A summary of your conversation."
"textSections": {
"DEFAULT_SECTION": "A summary of your conversation."
}
}
}
],
"latestSummary": {
"text": "A summary of your conversation."
"textSections": {
"DEFAULT_SECTION": "A summary of your conversation."
}
}
}
默认总结对话
您可以在项目设置中配置默认注释器选择器,这样就无需在每次创建分析时都指定总结配置。除非分析包含自己的注释器选择器,否则您设置的配置将用于所有分析。请注意,每次分析都会产生额外费用。
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{analysis_config: {annotator_selector: {run_summarization_annotator: true}}}' \
"https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/settings?updateMask=analysis_config"
Dialogflow 运行时集成
如果您启用 Dialogflow 运行时集成,那么 Agent Assist 创建的任何摘要也可以在 CX Insights 中查看。与其他 CX 洞见摘要一样,摘要内容以运行时注解的形式提供,并显示在最新的摘要字段中。
{
"name": "projects/PROJECT_ID/locations/LOCATION_ID/conversations/CONVERSATION_ID",
"dataSource": {
"dialogflowSource": {
"dialogflowConversation": "projects/PROJECT_ID/locations/us/conversations/CONVERSATION_ID",
"conversationDataItem": "projects/PROJECT_ID/locations/us/conversationDatasets/DATASET_ID/conversationDataItems/DATA_ITEM_ID"
}
},
…
"runtimeAnnotations": [
{
"annotationId": "projects/PROJECT_ID/locations/us/conversationDatasets/DATASET_ID/conversationDataItems/DATA_ITEM_ID/conversationAnnotations/ANNOTATION_ID",
"createTime": "2023-03-20T19:49:01.929940Z",
"startBoundary": {},
"endBoundary": {
"transcriptIndex": 1
},
"answerFeedback": {},
"conversationSummarizationSuggestion": {
"text": "The customer had a query about the service. Closed conversation prior to the resolution.",
"textSections": {
"DEFAULT_SECTION": "The customer had a query about the service. Closed conversation prior to the resolution."
}
}
}
],
"latestSummary": {
"text": "The customer had a query about the service. Closed conversation prior to the resolution.",
"textSections": {
"DEFAULT_SECTION": "The customer had a query about the service. Closed conversation prior to the resolution."
}
}
}
按摘要内容过滤对话
在 CX Insights 中列出对话时,您可以按摘要内容过滤对话。如需了解一般说明,请参阅列出对话。
CX Insights 支持对总结内容应用以下过滤条件:
- 包含摘要:
latest_summary:"*" - 无摘要:
-latest_summary:"*" - 包含短语的摘要:
latest_summary.text:"match this text" - 带有不含短语的摘要:
-latest_summary.text:"must not match this text"
在 BigQuery 中查看摘要
将 CX Insights 数据导出到 BigQuery 时,系统还会导出汇总数据。如需了解如何配置 BigQuery 导出,请参阅将对话导出到 BigQuery。
每次对话的最新摘要都位于 latest_summary 字段中:
bq query --use_legacy_sql=false 'SELECT conversationName, latestSummary.text FROM DATASET.TABLE'
所有摘要(包括最新摘要和所有过往摘要)均以句子级注释的形式提供:
bq query --use_legacy_sql=false <<EOF
SELECT
conversationName,
sen.sentence,
JSON_QUERY(JSON_VALUE(ant.annotationRecord), '$.text') AS summary_text
FROM
DATASET.TABLE,
UNNEST(`sentences`) AS sen,
UNNEST(`sen.annotations`) AS ant
WHERE ant.type = 'CONVERSATION_SUMMARIZATION_SUGGESTION'
EOF