将客户数据添加到 AI 代理会话 - Amazon Connect

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

将客户数据添加到 AI 代理会话

Amazon Connect 支持向 Connect 人工智能代理会话添加自定义数据,以便将其用于推动生成人工智能驱动的解决方案。要使用自定义数据,首先使用 UpdateSessionDataAPI 将其添加到会话中,然后使用添加的数据自定义 AI 提示。

在会话中添加和更新数据

您可以使用 UpdateSessionDataAPI 向会话添加数据。使用以下 AWS CLI 命令示例。

aws qconnect update-session-data \ --assistant-id <YOUR_CONNECT_AI_AGENT_ASSISTANT_ID> \ --session-id <YOUR_CONNECT_AI_AGENT_SESSION_ID> \ --data '[ { "key": "productId", "value": { "stringValue": "ABC-123" }}, ]'

由于会话是为联系人创建的,因此添加会话数据的一种有用方法是使用流程:使用AWS Lambda 函数区块调用 UpdateSessionDataAPI。此 API 可以向会话添加信息。

您需要执行以下操作:

  1. Connect 助手数据块添加到流中。它将 Connect AI 代理域与联系人关联,这样 Amazon Connect 就可以在知识库中搜索实时推荐。

  2. AWS Lambda 函数数据块放在 Connect 助手 数据块之后。UpdateSessionDataAPI 需要会话 ID。你可以使用 DescribeContactAPI 和与区块关联的 AssistanTid 来检索会话 ID。Connect 助手

下图显示了两个数据块,先是 Connect 助手 数据块,然后是 AWS Lambda 函数

配置为添加会话数据的 Connect 助手块和 AWS Lambda 函数块。

将自定义数据与人工智能提示结合使用

将数据添加到会话后,您可以自定义人工智能提示,以使用这些数据来获得生成式人工智能结果。

您可以使用以下格式为数据指定自定义变量:

  • {{$.Custom.<KEY>}}

例如,假设客户需要与特定产品相关的信息。您可以创建查询重构人工智能提示,该提示使用客户在会话期间提供的 productId。

以下来自人工智能提示的摘录显示 {{$.Custom.productId}} 正在提供给 LLM。

anthropic_version: bedrock-2023-05-31 system: You are an intelligent assistant that assists with query construction. messages: - role: user content: | Here is a conversation between a customer support agent and a customer <conversation> {{$.transcript}} </conversation> And here is the productId the customer is contacting us about <productId> {{$.Custom.productId}} </productId> Please read through the full conversation carefully and use it to formulate a query to find a relevant article from the company's knowledge base to help solve the customer's issue. Think carefully about the key details and specifics of the customer's problem. In <query> tags, write out the search query you would use to try to find the most relevant article, making sure to include important keywords and details from the conversation. The more relevant and specific the search query is to the customer's actual issue, the better. If a productId is specified, incorporate it in the query constructed to help scope down search results. Use the following output format <query>search query</query> and don't output anything else.

如果自定义变量的值在会话中不可用,则将其插值为空字符串。我们建议在人工智能提示中提供说明,以便系统考虑是否存在任何回退行为的值。