將自訂資料新增至 Amazon Q in Connect 工作階段 - Amazon Connect

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

將自訂資料新增至 Amazon Q in Connect 工作階段

Amazon Q in Connect 支援將自訂資料新增至 Amazon Q in Connect 工作階段,藉此將其用於支援提供給客服人員的生成式 AI 解決方案。您可以先使用 UpdateSessionData API,將自訂資料新增至工作階段,然後使用新增的資料來自訂 AI 提示。

新增和更新工作階段上的資料

您可以使用 UpdateSessionData API,將資料新增至工作階段。使用下列範例 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" }}, ]'

由於是在客服人員使用 Amazon Connect 和 Amazon Q in Connect 時為聯絡人建立工作階段,因此新增工作階段資料的實用方法是使用流程:使用 AWS Lambda 函數 區塊來呼叫 UpdateSessionData API。API 可以將資訊新增至工作階段。

以下是您執行的動作:

  1. Amazon Q in Connect 區塊新增至流程。它會將 Amazon Q in Connect 網域與聯絡人建立關聯,以讓 Amazon Connect 搜尋知識庫,取得即時建議。

  2. AWS Lambda 函數 區塊放置在 Amazon Q in Connect 區塊之後。UpdateSessionData API 需要來自 Amazon Q in Connect 的工作階段 ID。您可以使用 DescribeContact API 和與 Amazon Q in Connect 區塊相關的助理 ID 來擷取工作階段 ID。

下圖顯示兩個區塊,先是 Amazon Q in Connect,接著是 AWS Lambda 函數

Amazon Q in Connect 區塊和 AWS Lambda 函數區塊,設定為新增工作階段資料。

搭配使用自訂資料和 AI 提示

將資料新增至工作階段後,您可以自訂 AI 提示,以將資料用於生成式 AI 結果。

請使用下列格式,指定資料的自訂變數:

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

例如,假設客戶需要特定產品的相關資訊。您可以建立查詢重新格式化 AI 提示,使用客戶在工作階段提供的產品 ID。

以下來自 AI 提示的摘錄顯示提供給 LLM 的 {{$.Custom.productId}}。

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.

如果工作階段中無法使用自訂變數的值,Amazon Q in Connect 會將其插入為空白字串。建議您在 AI 提示中提供指示,以讓系統考慮是否有任何備用行為的值。