

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# （旧版）通过 Connect 人工智能代理使用人工智能驱动的生成式自助服务
<a name="generative-ai-powered-self-service"></a>

**重要**  
旧版自助服务未收到新功能更新。对于新的实施，我们建议使用[代理自助服务，](agentic-self-service.md)它提供自主的多步骤推理、MCP 工具集成和持续对话。

**提示**  
查看 AWS 研讨会的本课程：[自定义 Connect AI 代理自助服务](https://catalog.workshops.aws/amazon-q-in-connect/en-US/customizing-amazon-q-in-connect-self-service)。

Connect AI 代理支持聊天和语音 (IVR) 渠道中的客户自助服务用例。它可以：
+ 回答客户的问题。
+ 提供 step-by-step指导。
+ 完成诸如重新安排预约和预订行程之类的操作。

当客户需要其他帮助时，Connect AI 代理可以无缝地将其转移给客服，同时保留完整对话的背景。

**Topics**
+ [默认系统工具](#default-system-actions-for-ai-agents-self-service)
+ [设置自助服务](#enable-self-service-ai-agents)
+ [自助服务的自定义操作](#custom-actions-for-connect-ai-agents-self-service)
+ [FOLLOW\$1UP\$1QUESTION 工具](#follow-up-question-tool)

## 默认系统工具
<a name="default-system-actions-for-ai-agents-self-service"></a>

Connect AI 代理附带以下可用的内置工具 out-of-the-box：

1. **QUESTION**：当没有其它工具可以直接处理查询时，提供答案并收集相关信息。

1. **ESCALATION**：当客户请求人工协助时，自动转交给座席。
**注意**  
选择 ESCALATION 后，它将使用**获取客户输入**数据块的**错误**分支。

1. **CONVERSATION**：当没有具体的客户意图时，进行基本对话。

1. **COMPLETE**：满足客户需求后结束互动。

1. **FOLLOW\$1UP\$1QUESTION**：支持与客户进行更多的互动和信息收集对话。有关使用此工具的更多信息，请参阅 [FOLLOW\$1UP\$1QUESTION 工具](#follow-up-question-tool)。

您可以自定义这些默认工具，以满足您的特定要求。

## 设置自助服务
<a name="enable-self-service-ai-agents"></a>

请按照以下步骤启用 Connect AI 代理进行自助服务：

1. 通过激活亚马逊，在你的 Amazon Lex 机器人中启用 C [onnect AI 代理。 QinConnectIntent](https://docs.aws.amazon.com/lexv2/latest/dg/built-in-intent-qinconnect.html)。有关说明，请参阅[创建 Connect 人工智能代理意图](create-qic-intent-connect.md)。

1. 将 [Connect 助手](connect-assistant-block.md) 数据块添加到流中。

1. 将[获取客户输入](get-customer-input.md)数据块添加到流中，以指定：
   + 什么时候 Connect 人工智能代理应该开始处理客户互动。
   + 它应该处理哪些类型的互动。

   有关说明，请参阅[创建流并添加对话式 AI 机器人](create-bot-flow.md)。

1. （可选）向您的流程中添加一个[检查联系属性](check-contact-attributes.md)区块并对其进行配置以确定在 Connect AI 代理完成对话轮**到后应该发生什么：在待检查的属性**部分中，按以下方式设置属性：
   + 设置**命名空间** = **Lex**
   + 设置**键** = **会话属性**
   + 设置**会话属性键** = 工具

   Connect AI 代理将选定的工具名称保存为 Lex 会话属性。然后，可以使用**检查联系人属性**数据块来访问此会话属性。

1. （可选）根据 Connect AI 代理选择的工具定义路由逻辑：
   + 路由 COMPLETE 回复以结束互动。
   + 将自定义工具回复（如 TRIP\$1BOOKING）路由到特定的工作流程。

   下图显示了如何根据 Connect AI 代理的决定做出路由决策的示例。  
![\[联系人路由基于 AI 代理工具为 COMPLETE 和 TRIP_BOOKING 路径选择。\]](http://docs.aws.amazon.com/zh_cn/connect/latest/adminguide/images/generative-ai-powered-self-service-q-3.png)

## 自助服务的自定义操作
<a name="custom-actions-for-connect-ai-agents-self-service"></a>

您可以通过添加自定义工具来扩展 Connect AI 代理的功能。这些工具可以：
+ 为客户提供后续最佳操作。
+ 将任务委派给现有 Amazon Lex 机器人。
+ 处理特殊的使用案例。

 向人工智能提示添加自定义工具时：
+ 包括相关示例，帮助 Connect AI 代理选择适当的操作。
+ 使用[检查联系属性](check-contact-attributes.md)数据块创建分支逻辑。
  + 配置**检查联系人属性**时，在**要检查的属性**部分，输入自定义工具的名称。

  下图显示了指定名为 TRIP\$1BOOKING 的自定义工具。  
![\[“检查联系人属性”数据块中名为 TRIP_BOOKING 的自定义工具。\]](http://docs.aws.amazon.com/zh_cn/connect/latest/adminguide/images/trip-booking.png)

### 示例：消除客户意图的歧义
<a name="disambiguate-the-customer-intent"></a>

您可以创建一个生成式人工智能助手，用于在路由到座席之前收集信息。这要求：
+ 无知识库配置。
+ 收集信息的简单说明。
+ Step-by-step 向代理展示信息的指南。有关更多信息，请参阅 [在 Amazon Connect 中开始联系时在座席工作区中显示联系上下文](display-contact-attributes-sg.md)。

以下是用于消除歧义的示例工具定义。您可以移除除 CONVERSATION 之外的所有默认工具，然后添加一个新的名为 HANDOFF 的自定义工具：

```
tools:
- name: CONVERSATION
  description: Continue holding a casual conversation with the customer.
  input_schema:
    type: object
    properties:
      message:
        type: string
        description: The message you want to send next to hold a conversation and get an understanding of why the customer is calling.
    required:
    - message
- name: HANDOFF
  description: Used to hand off the customer engagement to a human agent with a summary of what the customer is calling about.
  input_schema:
    type: object
    properties:
      message:
        type: string
        description: Restatement to the customer of what you believe they are calling about and any pertinent information. MUST end with a statement that you are handing them off to an agent. Be as concise as possible.
      summary:
        type: string
        description: A list of reasons the customer has reached out in the format <SummaryItems><Item>Item one</Item><Item>Item two</Item></SummaryItems>. Each item in the Summary should be as discrete as possible.
    required:
    - message
    - summary
```

### 示例：向客户推荐操作
<a name="recommend-action-for-an-end-customer-to-take"></a>

 您可以使用流程在中 Amazon Connect 配置下一个最佳操作。您还可以配置自动操作并创建 step-by-step指南，为客户提供基于用户界面的操作。有关更多信息，请参阅 [Step-by-step 设置 Amazon Connect 代理工作空间的指南](step-by-step-guided-experiences.md)。  Connect AI 代理将选定的工具名称保存为 Lex 会话属性。然后，可以使用**检查联系人属性**流数据块来访问此属性。 

以下是预订行程的示例工具定义：

```
-name: TRIP_BOOKING
  description: Tool to transfer to another bot who can do trip bookings. Use this tool only when the last message from the customer indicates they want to book a trip or hotel.
  input_schema:
    type: object
    properties:
      message:
        type: string
        description: The polite message you want to send while transferring to the agent who can help with booking.
    required:
    - message
```

使用 “**检查联系人属性”** 流程块来确定 Connect AI 代理选择了哪个工具时，您可以做出分支决定，为该用户选择相关的 step-by-step指南。例如，如果客户想在自助聊天互动中预订行程，您可以：
+ 匹配流中的 TRIP\$1BOOKING 工具回复。
+ 前往相应的 step-by-step指南。
+ 直接在客户的聊天窗口中显示 step-by-step界面。

 有关在聊天中实现 step-by-step指南的更多信息，请参阅[在 Amazon Connect 聊天中部署 step-by-step指南](step-by-step-guides-chat.md)。

## FOLLOW\$1UP\$1QUESTION 工具
<a name="follow-up-question-tool"></a>

FOLLOW\$1UP\$1QUESTION 工具支持与客户进行更具互动性和信息收集性的对话，从而增强了 Connect AI 代理的自助服务功能。此工具可与默认工具和自定义工具一起使用。它有助于在确定要采取的操作之前收集必要的信息。

以下代码显示 FOLLOW\$1UP\$1QUESTION 工具的配置。

```
- name: FOLLOW_UP_QUESTION
  description: Ask follow-up questions to understand customer needs, clarify intent, 
and collect additional information throughout the conversation. Use this to gather 
required details before selecting appropriate actions.
  input_schema:
type: object
properties:
  message:
    type: string
    description: The message you want to send next in the conversation with the 
      customer. This message should be grounded in the conversation, polite, and 
      focused on gathering specific information.
required:
  - message
```

FOLLOW\$1UP\$1QUESTION 工具使得 Connect AI 代理能够在决定采取哪些操作之前收集必要的信息，从而补充您定义的工具。它特别适用于：
+  **消除意图的歧义**

  如果客户的意图不明确，可以使用此工具来要求澄清问题，然后再选择适当的操作。
+ **信息收集**

  收集完成任务或回答问题所需的详细信息。

### 示例 FOLLOW\$1UP\$1QUESTION 使用案例
<a name="follow-up-question-tool-use-case"></a>

对于旨在举报欺诈的自助服务机器人，您可以定义一个名为 CONFIRM\$1SUBMISSION 的工具来从客户收集特定的信息：

```
- name: CONFIRM_SUBMISSION
  description: Confirm all collected information and finalize the report submission.
  input_schema:
type: object
properties:
  message:
    type: string
    description: A message reviewing all of the collected information and asking 
      for final confirmation before submission.
  report_details:
    type: string
    description: The user's report or complaint details
  reporter_info:
    type: string
    description: Reporter's contact information (if provided) or "Anonymous"
  subject_info:
    type: string
    description: Information about the individual or business being reported
required:
  - message
  - report_details
  - reporter_info
  - subject_info
```

但是，您可以改用 FOLLOW\$1UP\$1QUESTION 工具来收集这些信息 step-by-step，如以下示例所示：

```
- name: FOLLOW_UP_QUESTION
  description: Ask follow-up questions to understand customer needs and collect additional 
information throughout the complaint process. Use this for all information gathering 
steps including confidentiality preferences, contact info, subject details etc.
  input_schema:
type: object
properties:
  message:
    type: string
    description: The message you want to send next in the conversation with the 
      customer. This message should be grounded in the conversation and polite. 
      Use this for asking clarification questions, collecting contact information, 
      gathering subject details, and all other follow-up steps in the complaint 
      process.
required:
  - message
```

### 提示说明
<a name="follow-up-question-prompt-instructions"></a>

向提示中添加说明，以指导自助服务机器人何时使用 FOLLOW\$1UP\$1QUESTION 工具。例如：

```
CRITICAL: Use FOLLOW_UP_QUESTION for all information gathering steps after the initial analysis. 
Do NOT proceed to other tools until you have collected all required information. Use this tool 
to disambiguate customer intent when unclear.

When using FOLLOW_UP_QUESTION:
1. Ask one specific question at a time
2. Focus on collecting required information for the most likely intent
3. Be conversational but direct
4. Acknowledge information the customer has already provided
5. Only move to other tools (like CONFIRM_SUBMISSION or TRIP_BOOKING) when you have all required 
   information
```

### 示例对话
<a name="follow-up-question-example-conversations"></a>

以下是三个示例对话，它们显示正在使用的 FOLLOW\$1UP\$1QUESTION 工具。
+ 示例 1：当客户询问有关举报欺诈行为时，模型需要从客户那里收集信息（例如 `report_details`、`reporter_info`、`subject_info`）来创建报告。此示例展示了如何使用 FOLLOW\$1UP\$1QUESTION 工具开始收集所需的信息，而不是使用名为 CONFIRM\$1SUBMISSION 工具的自定义工具来收集信息。
+ 示例 2：此示例延续了相同的主题，展示了可以使用 FOLLOW\$1UP\$1QUESTION 工具检索的举报者联系信息的替代信息。
+ 示例 3：此示例说明模型应如何回应客户的模糊请求并使用 FOLLOW\$1UP\$1QUESTION 工具来澄清问题。

```
<examples>
<example>
    <conversation>
        [CUSTOMER] I want to report someone who I think is committing fraud
    </conversation>
    <thinking>
        The customer wants to report fraud. I need to collect specific information 
        including details about the suspected fraud, reporter information, and 
        subject information. I'll start by asking about the suspected fraudulent activity.
    </thinking>
    <tool>
        [FOLLOW_UP_QUESTION(message="I'd be happy to help you report suspected fraud. 
        Could you please describe the fraudulent activity you've observed?")]
    </tool>
</example>

<example>
    <conversation>
        [AGENT] Can you provide me your full address?
        [CUSTOMER] I don't feel comfortable sharing my address
    </conversation>
    <thinking>
        The caller declined to share their address. I should respect their privacy 
        concerns while still trying to collect alternative contact information.
    </thinking>
    <tool>
        [FOLLOW_UP_QUESTION(message="I understand your privacy concerns. That's 
        completely fine. Would you be comfortable providing a phone number or email 
        address instead? Or you can choose to remain anonymous.")]
    </tool>
</example>

<example>
    <conversation>
        [CUSTOMER] I'm not getting my benefit payments anymore
    </conversation>
    <thinking>
        The customer is reporting a payment issue. This sounds like a general service 
        issue rather than fraud. I should clarify if they need assistance with their benefits.
    </thinking>
    <tool>
        [FOLLOW_UP_QUESTION(message="I'm sorry to hear about the issue with your payments. 
        To help me understand better, could you tell me when you last received a payment 
        and if you've received any notification about why they stopped?")]
    </tool>
</example>
</examples>
```