AI 教练:最佳实践

如需优化 AI 教练建议,您必须提供以下信息:

  • 一组书面说明
  • 对话转写文稿
  • 来自 API 的数据

作为回报,AI 指导师会提供适用的指令和建议的智能体回答。

为了获得最有用的建议,请在以下情况下使用 AI 教练。

追加销售和交叉销售

当联络中心客服人员必须提供其他产品或服务时,AI 教练可以提供以下实用信息。

  • 建议何时开始销售,以及何时完全不尝试销售。
  • 提出探究性问题,了解客户需求。
  • 根据对话上下文,从简短列表中推荐商品。
  • 建议如何处理异议。

客户留存率

当联络中心客服人员试图说服客户继续使用其公司的服务时,AI 教练可以提供以下实用信息。

  • 建议何时提供客户留存优惠。
  • 提出探究性问题,了解客户的取消原因。
  • 根据对话内容推荐客户挽留优惠。

使用工具实现单步自动化

AI 教练还可以根据客户服务对话自动执行以下重复性业务流程。

  • 当客户通过身份验证并提供订单号时,检索订单状态。
  • 在订单号和取消原因可用时取消订单。
  • 将有风险的自动化配置为需要人工审核和批准。

存在风险的操作

风险操作是指可能导致严重财务损失、数据泄露或违规的自动化业务流程。例如,未经身份验证就写入数据库和检索敏感信息。AI 教练可以建议时间安排并从对话中提取参数,但风险较高的操作需要人工审核和批准,不应完全自动化。

AI 教练说明

编写一组指令,教导 AI 教练在整个客户服务对话中,客服人员应采取哪些行动以及何时需要采取这些行动。指令可以指定任何客服人员操作,例如向客户询问其账号 PIN 码检查订单状态并告知客户提交取消请求

AI 教练指令包含以下信息:

  • 显示标题:有助于您管理多条指令。显示标题不会显示给 LLM。

  • 显示详细信息:指定模型在指令适用时应返回的静态内容。显示详情可以包括网址、内部工具或系统的快捷方式、客服人员的速查表或后端 API 调用。这些详细信息只有人工客服人员才能访问。显示详情对模型不可见

  • 条件:指定指令在对话中的适用时间。条件对模型可见。

  • 代理操作:指定当指令适用时,代理应采取哪些步骤。代理操作对模型可见。

  • 系统操作:指定在指令适用时要使用哪些自动化工具。系统操作对模型可见。

  • 触发事件:指定相应指令的触发事件。如果未指定,则与生成器的触发事件相同。

条件、代理操作和系统操作会影响 AI 教练的建议。

条件

条件必须清晰、简洁且独立。您可以使用客户问题的简要说明。撰写条件时,请像向不熟悉您商品的普通人描述那样自然表达。以下是一些实用条件的示例:

  • 客户想要取消订单。
  • 客户想要购买新手机。
  • 客户的互联网连接速度非常慢。

示例

以下是您可能会使用的条件和代理操作的示例。

  • 情况:客户要求将送货地址更新为新地址。
  • 智能体操作:如果客户尚未提供新地址,请询问客户希望使用哪个新地址来接收配送商品。

一般来说,只有在满足相关条件后,才会显示公司政策的文本。在此示例中,这意味着 AI 指导只会显示取消政策,前提是客户表达了取消意愿。在以下示例输入中,对话的预期主题反映在显示标题和条件中。向客服人员显示的文本内容在显示详情中定义。

AI 教练的输入内容:

display_title: order cancellation
display_detail: Company cancellation policy: Orders cannot be canceled more than 30 days after they have been placed. Only the cancellation team can process order cancellations.
condition: the customer wants to cancel an order
agent_action: N/A

代理操作

理想情况下,您可以根据以下三个信息来源验证代理操作的每个步骤:

  • 说明:详情请参阅上一部分。
  • 对话转写:记录客服人员和客户在整个客户服务对话中的对话内容。
  • 注入的数据:包含在对话中未直接找到的相关客户数据,例如近期交易、账单和正在进行的促销活动。

以下是 AI 教练可以使用的部分已提取数据的示例:

ingested_data_key: Product Recommendation
ingested_data_value:
* Microwave-safe, glass food container set, $29.99
* Gila Complete Window Film Application Kit, $19.99

缺少数据

如果代理操作需要的信息在指令的其他部分和对话转写中缺失,那么提供提取数据的 API 也必须提供缺失的信息。

  • 避免撰写任何需要使用这些来源中未提供的信息的操作。

  • 如果您找不到相应的数据,请避免:

    • 向客户说明账单。
    • 告知客户其余额、截止日期或订单状态。

多个动词

虽然上述智能体操作列表仅包含一个动词,表示智能体要采取的行动,但一个步骤可以包含多个动词。例如,如果某商家希望其客服人员在一个响应中推荐特定产品,并将该产品与(健康)状况相关联,那么您可以编写一个客服人员操作步骤,如以下输入所示。

display_title: recommend device protection
display_detail:
 trade-in process: [list steps for trade-in]
 device protection plan: [list plan details]
condition: the customer has issues/questions about trade-in
agent_action:
Recommend the device protection plan and tell the customer it can help them get better trade-in values in the future.

示例响应输出

智能体操作还可以利用已提取的数据,并为示例响应输出指定模板。例如,如果企业有多种产品需要推荐,并且希望客服代表根据对话内容提供相关建议,那么客服代表操作可以提示 AI 教练在示例回答输出中提供具体建议。此外,此示例还展示了如何编写代理操作,以提示 AI 教练生成符合模板的示例回答。

display_title: cross-selling
display_detail: see `Product Recommendations` for a relevant product
condition: the customer is inquiring about product availability
agent_action:
Summarize to the customer what product you have been discussing, then recommend a relevant product from the section titled "Product Recommendation" and provide a brief explanation of how the two products are relevant to each other. Use this template for sample responses: "Since we've been talking about ..., I'd like to recommend ... because ...".

Some examples:
- For TVs, recommend TV stands.
- For storage, recommend label writers.
- For slow cookers and microwaves, recommend food container sets.
- For air conditioners, recommend humidifiers.

多步骤操作

最后,代理操作可以包含多个步骤。多步骤代理操作用于指示当满足单个条件时,代理应如何继续对话。

请看以下示例,了解在处理订单取消事宜之前,客服人员需要询问一系列问题。每个步骤都会生成单独的示例回答。

display_title: order cancellation
display_detail:
 cancellation policy: [list policies]
 look up `[order number]` in ordering system
 how to cancel an order [list steps]
condition: the customer wants to cancel an order
agent_action:
1. Ask the customer for the order number.
2. Ask the customer why they want to cancel the order.
3. Inform the customer you are working on the cancellation.
4. Inform the customer that you have canceled the order.
5. Inform the customer that they will receive the refund in 5-7 business days.

请注意,如果没有其他集成,取消订单之类的步骤可能难以验证。在上面的示例中,我们将其替换为步骤 告知客户您正在处理取消事宜

系统操作

在系统操作中,我们可以引用已定义的工具。指令中的这一部分用于指定在满足指令条件时应考虑哪些工具。对工具的引用应采用以下格式:${tool:tool_name|action_name}。如需详细了解如何设置工具,请参阅 OpenAPI 和 Integration Connectors 工具页面。

以下是一些系统操作示例:

示例 1:列出工具和操作名称。

...
system_action:
${tool:order_management|cancel_order}, ${tool:order_management|check_order}

示例 2:添加条件行为。

...
system_action:
* if "RESPONSE TO ${TOOL:ORDER_MANAGEMENT|CANCEL_ORDER}" is already present without any error, skip ${tool:order_management|cancel_order} 
* if the order number has been provided, use ${tool:order_management|cancel_order} 
* if "RESPONSE TO ${TOOL:GETORDERDETAILS|GETORDERDETAILS}" shows errors or failures, retry ${tool: order_management | cancel_order}

AI 教练中的总体指导使用情况

AI 指导教练新增了一个可配置的提示部分,称为“总体指导”,用于指定以下内容:

  • 术语库
  • 示例回答建议的风格、格式和语气指南
  • 有关如何使用和遵循说明的重要注意事项

术语库

以下词汇表清晰定义了弱势客户账号身份验证。有了这份总体指南中的词汇表,您就可以在说明中使用相关术语,而无需像旧版 AI 指导那样重复定义这些术语。

#### Vulnerable customer

A customer is considered a vulnerable customer when at least one of the following is true:

- The customer is experiencing financial hardship.
- The customer has a physical disability or chronic health condition.
- The customer is facing domestic abuse or is in an unsafe situation.

#### Account authentication

Account authentication is considered completed if the account PIN provided by the customer matches the account PIN in the data section *Account PIN*.

样式、格式和基调指南

在示例回答中,请遵循以下样式、格式和语气指南:

  • 始终保持同理心、耐心和安抚的态度。
  • 避免使用过于随意的语言或俚语。保持尊重而热情的语气。
  • 回答必须始终明确承认客户的感受或顾虑(例如:“我理解您很沮丧”)。
  • 使用简短的句子,避免使用复杂的语言或术语。
  • 切勿指责或反驳客户。而是应温和地引导他们了解正确的信息。
  • 在每次回复中,首先明确承认客户的主要疑虑。

指令遵从注意事项

添加有关如何遵循您的说明的注释。为了改进自动建议,您还可以使用笔记来指定思考或推理过程。

示例

示例 1:配置模型行为

### Follow instructions
* An instruction is applicable if and only if both of the following are true:
  * The condition is met by the conversation and the contexts.
  * Some of the agent actions are not completed yet. (If all the agent actions are done, then the instruction no longer applies.)
* Notes on following the applicable instructions:
  * Do not suggest any sample responses or agent actions that are not specified in the applicable instructions.
  * Do not ask for information not specified in the instructions.
  * If an agent action step is to ask for information that the customer has already provided, then the step should be skipped.
  * **Your suggested responses should fit into the conversation flow**. For example, if the customer and the support agent has moved on to a new issue, you should stop making suggestions for the old issue.
* Each sample response (or agent action suggestion) must be concise and only carry out one step in the applicable instruction. Do not cover multiple steps within one sample response (or agent action suggestion).
* Avoid repetition:
  * Do not suggest sample responses or agent actions that the agent has already said or done earlier in the conversation.
  * Do not ask for information that is already available in the conversation or the contexts.
* For product names, when you provide parameters in system action suggestions, provide the full names, including available specs.
* If multiple instructions lead to the same or similar suggestion, give one suggestion, but with multiple sources.

示例 2:调整指令优先级并指定思考过程,以获得更准确的建议

### Notes on how to use or follow instructions
If there are multiple instructions applicable at the same time, **suggest only one instruction as applicable based on the following priority (from highest to lowest)**:
* [Highest priority] security related

Example: Account authentication is required before anything else.

* [High priority] customer retention
* [Medium priority] issue resolution
* [Low priority] upselling or cross-selling

### Thinking process
Before you make any suggestions, answer the following questions in this output section:
* For each instruction, is it applicable? If yes, what is its priority?
* Which instruction has the highest priority?

以下示例说明了相同的指令优先级,并举例说明了模型在特定情况下应建议的内容。

### Notes on how to use or follow instructions
If there are multiple instructions applicable at the same time, **suggest only one instruction as applicable based on the following priority (from highest to lowest)**:
* [Highest priority] security related

Examnple: Account authentication is required before anything else.

* [High priority] customer retention
* [Medium priority] issue resolution
* [Low priority] up-selling or cross-selling

#### Examples to follow
<example_1>
<instructions>
...
instruction I1
condition: the customer wants to inquire about their current plan
agent action: inform the customer of what plan they have and what features they get
...
instruction I2
condition: the authentication is not done yet
agent action: ask for the account PIN
...
</instructions>
<conversation>
customer: can you tell me what plan I have?
</conversation>
<good_suggestion>
may I have your account PIN, please?
</good_suggestion>
<bad_suggestion>
sure, let me pull up your account information.
</bad_suggestion>
<comment>
Both instructions I1 and I2 are applicable, but I1 should have the highest priority because it's security related. Therefore, asking for the account PIN is a good suggestion.
</comment>
</example_1>

AI 教练中的实体提取

实体提取功能可让 AI 教练执行以下操作:

  • 自动识别并保存重要信息(用户地址、账号或实时转写中的产品名称)。
  • 防止您手动输入数据。
  • 确保您的 CRM 系统准确无误。
  • 加快工作流程。

为了优化该功能的性能,请确保 AI 教练生成器配置包含以下详细信息:

  • 清晰的说明
  • 已定义的工具结构
  • 总体指导

定义函数工具

工具定义用于指定要提取的数据的一组指令。以下示例展示了使用 JSON 定义的用于提取地址实体的函数工具

{
  "type": "object",
  "properties": {
    "phone_number": {
      "description": "A complete US phone number. ONLY extract if a fully visible 10 or 11-digit number is present. CRITICAL: If no valid value is found, you are FORBIDDEN from generating this key. DO NOT output 'phone_number': null.",
      "type": "string"
    },
    "full_person_name": {
      "description": "The full name of a real person. EXCLUDE: Generic roles, pronouns, or objects. CRITICAL: If no valid value is found, you are FORBIDDEN from generating this key. DO NOT output 'full_person_name': null.",
      "type": "string"
    },
    "address": {
      "description": "A complete physical address. MUST contain ALL FOUR: street number, street name, city and zipcode. Omit if incomplete.",
      "type": "string"
    }
  },
  "required": []
}

以下示例展示了输出架构。

{
  "properties": {
    "status": {
      "description": "Execution status indicating if entities were processed.",
      "type": "string"
    }
  },
  "type": "object"
}

生成器配置

生成器配置包含高级规则和逻辑,用于告知 AI 教练何时以及如何执行实体提取。例如:

{
  "displayName": "Address Extraction Generator",
  "instructions": [
    {
      "displayTitle": "Extract Address Update",
      "condition": "The customer's most recent message explicitly mentions an address",
      "agentAction": "N/A",
      "systemAction": "${tool:crm_update|update_member_address}"
    }
  ],
  "overarchingGuidance": "Prioritize current address over previous mentioned addresses. If unsure about address type, default to 'Permanent'."
}

数据转移

当 AI 教练成功提取实体数据并启动工具时,API 会以 ToolCall 对象的形式向后端系统提供结果。此数据传送包含以下组件:

  • 字段:收集的数据以消息的 inputParameters 部分进行编码。
  • 结构:后端系统已设置为接收此 toolCall 对象。系统会使用 inputParameters 并将其映射到相应字段,以更新数据库。该结构编码在 GeneratorSuggestiontoolCall 字段中。

示例

下表显示了客户与客服人员之间的实时互动。最后一列显示了 AI 教练如何通过分析客户话语来指导客服人员。

Turn 角色 话语 AI 教练逻辑和操作
1 客户 “您好,我刚刚搬家,需要更新地址。” 检测到的意图:update_address
2 代理 “没问题,我可以帮忙。新地址是什么?” --
3 客户 “It's 123 Main Street in Austin, Texas.” 分析:检测街道、城市和州。反馈:“缺少邮政编码。请客户提供邮政编码。”
4 代理 “Got it. 以及该地点的邮政编码是什么?” --
5 客户 “哦,是 78701。” 分析:强制性实体已完成。系统操作:触发 update_member_address 工具。数据在 `inputParameters` 中返回。
6 代理 “好的,我已经将您的永久地址更新为 123 Main Street, Austin, TX 78701。” 客服人员在 CRM 中验证预填的表单。

互动中的关键要点包括:

  • 意图检测:在第 1 轮对话中,AI 教练立即识别出客户的目标:更新地址。
  • 分析和指导:在第 3 轮对话中,AI 指导确定缺少邮政编码,并发送反馈以确保客服人员收集邮政编码。
  • 自动化操作:在第 5 轮中收集完所有必需的实体后,AI 教练会激活系统工具。这样一来,数据会直接发送到 CRM,也就是说,客服人员无需手动将地址输入到数据库中。

总体指导

AI 指导添加了一个可配置的提示部分,称为总体指导,您可以在其中设置适用于所有数据提取的全局规则。此总体指南指定了以下详细信息:

  • 词汇表:您可以定义术语的含义。例如,将生效日期定义为更改生效的日期。
  • 思考过程:您可以让 AI 教练执行特定的推理步骤,例如回顾过去五轮对话,确认名称和数字,然后再采取任何行动。

实施计划

请按照以下步骤成功部署 AI 教练实体提取功能。第一阶段是设置:

  1. 创建工具并定义要捕获的所有关键数据的架构。
  2. 指定应激活 AI 指导的高级 intent。例如,客户想要更新地址。定义系统操作。

第二阶段涉及测试和改进:

  1. 使用真实转写内容来缩小触发范围并减少误报。
  2. 更新指令,告知客服人员在客户缺少必需信息时应采取的行动。
  3. 确认收集的数据能够从客户对话中正确流经 inputParameters,进入您的 CRM 或其他系统。

AI 教练输出语言

AI 教练会以指定的输出语言生成建议。如果未指定输出语言,模型会决定建议的输出语言。

AI 教练输出

AI 教练会返回以下一项或两项结果:

  • 适用的指令:可以返回多条适用的指令,每条指令都有其显示标题和详细信息。

  • 回答示例:AI 辅导还会生成智能体在对话中可能做出的回答示例。这些回答示例基于指令、对话上下文和已提取的数据。示例响应也可以为空。

质量改进

以下有关撰写 AI 指导教练指令的建议有助于提高示例回答的质量,但无法阻止 AI 指导教练提出意外建议。

用于显示详细信息的文本格式

使用 Markdown 语法以富格式(链接、粗体文字等)显示详细信息。这会在 Google Cloud 控制台模拟器中呈现,但也有助于在网页界面中实现。

代理操作的文本格式

如果 AI 教练经常遗漏某个步骤或要求,请使用粗体文字来引导模型更加关注特定文本。如需使用 Markdown 语法创建粗体文字,请在文字两侧各添加两个星号。

display_title: order cancellation
display_detail:
 cancellation policy: [list policies]
 look up `[order number]` in ordering system
 how to cancel an order [list steps]
condition: the customer wants to cancel an order
agent_action:
1. ask the customer for the order number
2. **ask the customer why they want to cancel the order**
3. inform the customer you are working on the cancellation
4. inform the customer that you have canceled the order
5. inform the customer that they will receive the refund in 5-7 business days

例如,如果代理操作的每个步骤都加粗,粗体文字的效果就会降低。因此,请谨慎使用此方法。

添加具体示例

如果 AI 教练无法给出您预期的示例回答,您可以向代理操作添加一些您希望看到的示例,这会有所帮助。以下详细示例展示了如何使用轻量级示例(突出显示):

display_title: smartwatch recommendation
display_detail: see `Smartwatch Catalog` for a relevant smartwatch
condition: the customer recently purchased phones
agent action:
recommend a specific smartwatch from the section titled "Smartwatch Catalog"; the recommendation should match the recently purchased phones from the section titled "Recent Purchases".
Following are some examples:
- For Galaxy phones, recommend Galaxy watch.
- For iPhones, recommend Apple Watch.
- For Pixel phones, recommend Pixel Watch. 
- For other phones, recommend Fitbit Sense.

如果没有这些轻量级示例,AI 教练可能会建议使用适用于 Android 的 Apple Watch,或者列出所有可用的智能手表。使用轻量级示例时,建议非常精准。

消息模板

如需控制生成的示例回答的措辞和格式,请在代理操作中附加消息模板,甚至附加静态固定消息。与轻量级示例不同,这些模板会指明示例回答中应使用的确切措辞。以下示例突出显示了消息模板。

display_title: bill explanation
display_detail:
 look up `[account number]`
 check `Recent Bills` to compare amounts
 https://www.[company name].com/promos
condition: the customer wonders why the bill is getting higher this month
agent_action:
1. ask the customer for the account number. use this fixed message for sample responses: "May I have your account number, please?"
2. compare the bills in the last two months from the section titled "Recent Bills" and inform the customer of the extra charge. use this template for sample responses: "Compared with last month, this month you have an extra charge for ..., which costs ..."

引导式推理

如果一条或多条指令指定了目标,但步骤不够或未阐明实现目标的隐藏推理,请修改步骤以提高清晰度。例如,当代理被告知要推荐产品时,建议的产品应与对话内容相关。通过在代理操作的开头添加引用对话上下文的子任务,帮助 AI 教练提供相关建议。

display_title: cross-selling
display_detail: sample response
condition: the customer is inquiring about product availability
agent_action:
summarize to the customer what product you have been discussing, then recommend a relevant product from the section titled "Product Recommendation" and provide a brief explanation of how the two products are relevant to each other. Use this template for sample responses: "Since we've been talking about ..., I'd like to recommend ... because ...".

在此示例中,主要任务是建议与对话相关的产品。AI 教练可能会跑题,并推荐商品推荐部分中列出的第一个商品。添加子任务可以显著提高相关性。此外,在代理操作结束时添加消息模板,以便子任务结果顺利融入示例回答中。

添加建议重复信息删除功能

AI 教练建议去重功能可防止向客服人员显示重复或高度相似的建议。使用生成器 proto 中的 SuggestionDedupingConfig 字段将建议组件(指令、示例回答等)与最近的建议历史记录进行比较。您可以使用可配置的阈值来调整相似度的敏感度。DuplicateCheckResult 消息提供建议响应中去重检查的结果。

配置建议去重

如需管理 AI 指导的重复建议,请在生成器的配置中配置 SuggestionDedupingConfig

配置字段

SuggestionDedupingConfig 具有以下字段:

  • enable_deduping:将此布尔值字段设置为 true 可启用建议去重功能。如果将其设置为 false 或未设置,系统会停用去重功能。 示例:

    suggestion_deduping_config {
    enable_deduping: true
    }
    
  • similarity_threshold:使用此浮点型阈值对特定字段进行基于相似性的去重。去重流程会将相似度得分高于此值的建议视为重复建议。得分范围为 0.0 到 1.0。将此字段设置为 0.0 或将其留空,则使用默认阈值 0.8。 示例:

    suggestion_deduping_config {
    enable_deduping: true
    similarity_threshold: 0.85
    }
    

去重功能的工作原理

enable_deduping 为 true 时,您可以将建议与历史建议进行比较。去重流程会评估以下每个建议字段的重复情况:

  • 说明 (applicable_instructions):检查是否与历史记录建议完全匹配。
  • 示例响应 (sample_responses):检查当前建议与历史建议之间的相似性。如果相似度得分超过相似度阈值,去重标志会标记重复结果。
  • 代理操作 (agent_action_suggestions):检查当前建议与历史建议之间的相似性,类似于示例回答。如果相似度得分超过相似度阈值,去重标志会标记重复结果。 重复数据删除检查的结果会包含在 DuplicateCheckResult 消息中返回。

输出:DuplicateCheckResult

AgentCoachingSuggestion 消息包含不同类型建议的字段(例如 AgentActionSuggestionSampleResponse)。每个字段都将包含一个 DuplicateCheckResult 消息,用于提供有关历史记录中发现的潜在重复项的信息。 示例:

// Example within AgentActionSuggestion
message AgentActionSuggestion {
  // ... other fields ...
  DuplicateCheckResult duplicate_check_result = 3;
}

// Duplication check for the suggestion.
message DuplicateCheckResult {
  // The duplicate suggestions.
  repeated DuplicateSuggestion duplicate_suggestions = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (datapol.semantic_type) = ST_NOT_REQUIRED
  ];

  // The duplicate suggestion details.
  message DuplicateSuggestion {
    // The answer record ID of the past duplicate suggestion.
    string answer_record = 1 [
      (google.api.field_behavior) = OUTPUT_ONLY,
      (datapol.semantic_type) = ST_IDENTIFYING_ID
    ];
    // Sources for the suggestion.
    Sources sources = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
    // The index of the duplicate suggestion in the past suggestion list.
    int32 suggestion_index = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
    // The similarity score of between the past and current suggestion.
    // This is only populated for fields using similarity checks.
    float similarity_score = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  }
}

配置示例

示例生成器配置通过将 enable_deduping 设置为 true 来启用建议去重功能。此外,它还会将 similarity_threshold 值设置为 0.75。这意味着,如果新建议(针对示例回答和代理操作)的文本与任何历史建议的相似度得分大于或等于 0.75,去重功能会将其标记为重复项,并将其 DuplicateCheckResult 设置为 true。

# Example Generator configuration with Deduping enabled
generator {
  # ... other generator fields ...

  suggestion_deduping_config {
    enable_deduping: true
    similarity_threshold: 0.75 # Optional: Adjusts sensitivity for similarity checks
  }

  # ... rest of generator config ...
}