向 Amazon Q in Connect 会话添加自定义数据 - Amazon Connect

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

向 Amazon Q in Connect 会话添加自定义数据

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

添加和更新会话数据

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

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

由于会话是在客户服务代理在 Connect 中使用 Amazon Connect 和 Amazon Q 时为联系人创建的,因此添加会话数据的一种有用方法是使用流程:使用AWS Lambda 函数区块调用 UpdateSessionDataAPI。API 可以向会话添加信息。

您需要执行以下操作:

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

  2. 将方AWS Lambda 函数块放在你的Amazon Q in Connect方块之后。该 UpdateSessionDataAPI 需要来自 Connect 中的 Amazon Q 的会话 ID。你可以使用 DescribeContactAPI 和与区块关联的 AssistanTid 来检索会话 ID。Amazon Q in Connect

下图显示了两个方块,先是方块,Amazon Q in Connect然后是AWS Lambda 函数

配置为添加会话数据的 Amazon Q in Connect 区块和 AWS Lambda 函数块。

使用带有 AI 提示的自定义数据

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

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

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

例如,假设客户需要与特定产品相关的信息。您可以使用客户在会话中提供的 productID 创建查询重新配方 AI 提示。

以下摘自 AI 提示符显示 {{$.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.

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