自動標籤和關聯規則

Customer Experience Insights 推出兩項以規則為基礎的功能,可提升對話處理成效:

  • 自動標籤規則:根據定義的條件,自動將鍵值標籤套用至對話。
  • 關聯規則:定義如何將相關的對話片段連結在一起,形成完整的顧客互動檢視畫面。

這兩種規則類型都使用一般運算語言 (CEL),提供彈性且動態的規則定義。CEL 是自動標記和關聯規則的基礎。您可以使用 API 或 CX Insights 控制台設定這些規則。

自動標籤規則

自動標籤規則會在匯入期間,自動為對話加上自訂鍵/值標籤。這些標籤可提升篩選、分類和整合其他分析及工作流程的成效。您可以透過自動標記規則執行下列動作:

  • 依主題、顧客類型、產品或結果分類對話。
  • 從對話中繼資料或 Dialogflow 參數 (例如 callIdisAuthenticatedintent 名稱) 擷取重要資料點,並匯入標籤。
  • 標記需要特別注意的對話,例如 high_escalation_risk

標籤

每項自動標籤規則都會定義標籤,並包含依序排列的條件訊息。每個標籤都使用下列 CEL 運算式:

  • 條件:評估對話是否為 True 或 False。空白條件預設為 true。
  • :如果條件為 true,則產生標籤的字串值。

系統會根據第一個相符的 LabelingCondition 決定標籤值。

設定規則

請按照下列步驟,使用 API 或 CX Insights 主控台設定自動標籤規則。

API

  1. 使用 Create 作業設定 AutoLabelingRule。要求主體範例:

    {
      "displayName": "$DISPLAY_NAME",
      "labelKey": "$UNIQUE_KEY_NAME",
      "labelKeyType": LABEL_KEY_TYPE_CUSTOM 
    "conditions": [
        {
          "condition": "conversation.turn_count > 10 && conversation.duration > "60s"",
          "value": "'long_call'"
        },
        {
          "condition": "conversation.agent_id == "agent_007"",
          "value": "'special_agent'"
        }
      ],
    "active": true
    }

    Curl 指令 (如果要求儲存在 auto_labeling_rule.json 中):

      curl-X POST 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8"
    -d @auto_labeling_rule.json
    "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/autoLabelingRules?auto_labeling_rule_id=$RULE_ID"

  2. 請按照下列格式為規則命名:projects/[project-id]/locations/[location-id]/autoLabelingRules/[auto_labeling_rule][auto_labeling_rule] ID 是自訂規則的 label_key

您也可以對自動標記規則執行下列任一作業。每則對話最多可有 100 個自動標籤規則,每個項目最多 256 個字元。

  • Get
    curl  -X GET 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8" \ "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/autoLabelingRules/$RULE_ID"
  • List
    curl  -X GET 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8" \ "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/autoLabelingRules"
  • Update。 視要更新的欄位而定,指定 update_mask
    curl  -X PATCH 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8"
    -d @update_payload.json \ "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/autoLabelingRules/$RULE_ID?update_mask=displayName,active"
  • TestAutoLabelingRule。 酬載應包含要測試的規則,以及系統將根據規則評估的範例對話。範例:
    {
    "conversation": {
    "agentId": "agent_007",
    "turnCount": 15,
    "duration": "75s"
    /# Add other conversation fields relevant to the rule
    },
    "autoLabelingRule": {
    "displayName": "Test Rule",
    "labelKey": "test_category",
    "conditions": [
      {
       "condition": "conversation.turn_count > 10 && conversation.duration > "60s"",
        "value": "'long_call_test'"
      }
    ],
    "active": true
    }
    }

控制台

  1. 前往 CX Insights 控制台,登入並選取專案。 CX Insights 主控台
  2. 依序點選「設定」 >「自動標籤規則」
  3. 使用 Monaco 編輯器輸入 CEL 運算式。
  4. 按一下 [儲存]

CEL 範例

  • 依代理商 ID 標籤:
    label_key: "agent_category"
    conditions {
    condition: "conversation.agent_id == '007'"
    value: "'special_agent'"
    }
    conditions {
    condition: "conversation.agent_id.startsWith('team_a')"
    value: "'tier_1_support'"
    }
    conditions {
    condition: "" // Default
    value: "'standard'"
    }
  • 標記負面情緒:
    label_key: "needs_review"
    conditions {
    // This example assumes sentiment scores are present in the conversation's latest_analysis
    condition: "has(conversation.latest_analysis.analysis_result.call_analysis_metadata.sentiments) && conversation.latest_analysis. analysis_result.call_analysis_metadata.sentiments.exists(s, s.    sentiment_data.score < -0.5)"
    value: "'true'"
    }
  • 擷取 Dialogflow 參數:
    label_key: "df_session_outcome"
    conditions {
    condition: "" // Always try to extract
    value: "conversation.runtime_annotations.map(a, a.dialogflow_interaction.detect_intent_response_v3.query_result.parameters).filter(p, has(p.outcome)).map(p, p.outcome).first_element_or_empty_string()"
    }

在分析規則篩選器中使用自動標籤

自動標籤規則可套用標籤,控管主要分析規則處理哪些對話。分析規則中的 conversation_filter 欄位可以使用標籤對應參照標籤。

範例:

// AnalysisRule to run detailed analysis on conversations labeled 'needs_review: true'
display_name: "Detailed Analysis for Reviewed Conversations"
conversation_filter: "labels.needs_review = \"true\""
annotator_selector: {
  run_summarization_annotator: true
  // ... other annotators
}
analysis_percentage: 1.0
active: true

關聯規則

關聯規則會定義 Customer Experience Insights 如何識別及連結相關的對話片段。對話片段代表擷取的單一對話內容,例如 Dialogflow 工作階段或單一服務專員互動。完整對話是指由一或多個區隔組成的完整連結對話。根據預設,所有新對話都會以區隔形式開始。關聯規則可協助您建立完整的顧客互動記錄,即使互動橫跨多位服務專員、管道或工作階段也沒問題。

關聯規則可為顧客服務對話分析帶來下列好處。

  • 整合轉錄稿:查看單一的依時間排序轉錄稿,其中整合了多個來源的語音內容,例如聊天機器人對話和隨後的真人服務專員通話。
  • 跨管道分析:連結不同管道 (例如即時通訊和語音) 的互動,分析整個對話歷程中的情緒趨勢和主題進展。
  • 指標準確度:計算完整互動的指標,例如總處理時間或解決率,而非僅計算個別部分。
  • 服務專員的背景資訊:提供先前自動互動的完整記錄給真人服務專員。

關聯程序

如果關聯規則比對到多個對話片段,CX Insights 會將這些片段分組。CX Insights 接著會建立新項目,代表完整對話,並指派專屬對話 ID。CX Insights 會將完整對話的關聯 ID 設為連結區隔的通用鍵,並將其類型設為 FULL。CX Insights 會將原始區隔的關聯 ID 設為通用鍵,並將類型設為 SEGMENT。如果區隔與任何其他區隔沒有關聯,CX Insights 會同時提供 SEGMENTFULL 關聯類型。

關聯規則會連結來自不同來源和管道的相關對話區隔。CX Insights 會按照下列步驟連結對話片段:

  1. 依聯結鍵分組:CX Insights 會評估 CEL 聯結鍵運算式,從對話中擷取通用 ID,例如 callId。如果對話共用相同的加入金鑰,就可能適合連結。連結鍵必須具體明確,如果某個鍵與超過 20 個對話相符,系統可能會拒絕建立關聯,以免發生效能問題。
  2. 使用限制條件調整:CEL 限制運算式是選用的布林值檢查,會成對評估候選人。這個運算式有助於確認共用金鑰的兩個區隔是否應實際連結。這項檢查是雙向的,因此可能包含連結至區隔 B 的區隔 A,以及連結至區隔 A 的區隔 B。
  3. 遞移連結:連結是遞移的。如果對話 A 連結至 B,而 B 連結至 C,則 A、B 和 C 會合併為單一FULL對話群組。

合併的對話最多可包含五個區段。

設定關聯規則

您可以使用 API 或 CX Insights 控制台設定關聯規則。

API

  1. 執行下列程式碼,設定 CorrelationConfig
    curl  -X PATCH 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8"
    -d @update_corr_config.json
    "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/correlationConfig?update_mask=fullConversationConfig"
  2. 為規則命名,格式如下: projects/{project-id}/locations/{location-id}/correlationConfig
  3. 在「Conversation.CorrelationInfo」欄位中查看結果。

您可以使用下列任一作業搭配關聯性規則。

  • GetCorrelationConfig
    curl-X GET 
    -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)"
    -H "Content-Type: application/json; charset=utf-8"
    "https://$ENDPOINT/v1/projects/$PROJECT/locations/$LOCATION/correlationConfig"
  • UpdateCorrelationConfig。 如果儲存在 updated_corr_config.json 中,要求主體範例如下:
    {
    "fullConversationConfig": {
    "correlationRules": [
      {
        "joinKeyExpression": "conversation.labels.uui",
        "active": true
      }
    ]
    }
    }
  • TestCorrelationConfig。 除了關聯規則,酬載也應指定範例對話詳細資料,以利測試。範例:
    {
    "correlationConfig": {
    "fullConversationConfig": {
      "correlationRules": [
       {
          "joinKeyExpression": "conversation.agent_id",
         "active": true
        }
      ]
    }
    },
    "filter": "agent_id="agent_007"",
    "maxSampleCount": 100
    }

控制台

  1. 前往 CX Insights 控制台,登入並選取專案。 CX Insights 主控台
  2. 依序點選「設定」 >「關聯設定」
  3. 按一下 [儲存]

管理員可以在 CorrelationConfig 中定義及管理 CorrelationRule 項目。選取對話即可測試關聯規則。測試結果會新增至資料集供您查看。

CEL 範例

透過 Dialogflow 連結:callId

join_key_expression:
// Extracts 'callId' from Dialogflow parameters, falls back to conversation name.
default(conversation.runtime_annotations.map(a,
  a.dialogflow_interaction.detect_intent_response_v3.query_result.parameters)
  .filter(p, has(p.callId))
  .map(p, p.callId)
  .first_element_or_empty_string(), conversation.name)

區隔和對話層級分析

透過 CX Insights,您可以分析不同精細程度的對話,包括所有功能的每個區隔和每場對話分析。

  1. 前往 CX Insights 控制台,登入並選取專案。 CX Insights 主控台
  2. 依序點按「設定」「設定」,然後選擇分析精細度。這項選擇會套用至日後的分析,也可以追溯套用,但可能需要額外付費。
  3. 按一下 [儲存]

控制台中的「對話中心」和「品質 AI」頁面會比較對話和區隔層級的資料,並指出連結對話的多區隔結構。

篩選指標和分析

如要在 API 或控制台中指定分析層級,請使用下列篩選器。

區隔層級檢視畫面

這個檢視畫面的目標是分析互動的特定部分,例如單一服務專員的回合。使用 correlation_info.correlation_types:SEGMENT 參數篩選區隔層級檢視畫面。

完整對話檢視畫面

無論顧客流程是由已連結或獨立的對話組成,您都可以使用這個檢視畫面分析完整的顧客流程。使用 correlation_info.correlation_types:FULL 參數篩選完整對話檢視畫面。