啟用摘要功能

摘要註解者會傳回客戶體驗洞察對話的摘要。摘要功能是 Agent Assist 的一項功能,只能與 CX Insights 搭配使用,或與預先存在的 Agent Assist 對話設定檔搭配使用。本頁說明如何啟用摘要註解器。

帳單

Customer Experience Insights 會使用 Agent Assist 生成對話摘要。為客戶體驗洞察分析導入摘要功能後,帳單上會新增一行明細項目,列出 Agent Assist API 的用量。詳情請參閱 Agent Assist 定價頁面。

AnnotatorSelector

與其他分析註解器不同,摘要註解器預設為停用。如要啟用這項功能,請將 AnnotatorSelector.run_summarization_annotator 設為 true

如果要求中指定 AnnotatorSelector,CX Insights 會執行明確啟用的註解工具。如要執行摘要以外的註解工具,請在要求中啟用註解工具。如需可用選項,請參閱「AnnotatorSelector」。

必要條件

為專案啟用 Dialogflow APICustomer Experience Insights API。 Google Cloud

使用 CX Insights 分析功能生成對話摘要

您可以為 CX Insights 對話建立分析,藉此生成摘要。詳情請參閱「使用 API 建立及分析對話」。建立分析時,系統會啟用摘要功能,並使用註解工具選取器設定摘要。

如需各摘要模型支援的語言清單,請參閱 Agent Assist 語言支援說明文件

使用生成式摘要模型

Agent Assist 也提供以 LLM 為基礎的摘要功能,可自訂摘要內容,並使用生成器模型。你可以使用預先定義區段的生成器模型,也可以定義自訂區段。

請按照下列步驟,使用以大型語言模型為基礎的生成器模型自動生成摘要。

  1. 按照 Agent Assist 的操作說明建立摘要生成器
  2. run_summarization_annotator 設為 true
  3. 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 執行階段整合功能,您也可以在 CX Insights 中查看 Agent Assist 建立的摘要。與其他 CX Insights 摘要一樣,摘要內容會以執行階段註解和最新摘要欄位提供。

{
  "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