從 Lex V2 在 Amazon CloudWatch Logs 中檢視文字日誌 - Amazon Lex

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

從 Lex V2 在 Amazon CloudWatch Logs 中檢視文字日誌

Amazon Lex V2 會將對話的文字日誌存放在 Amazon CloudWatch Logs 中。若要檢視日誌,請使用 CloudWatch Logs 主控台或 API。如需詳細資訊,請參閱《Amazon CloudWatch Logs 使用者指南》中的使用篩選條件模式和 CloudWatch Logs Insights 查詢語法搜尋日誌資料Amazon CloudWatch

使用 Amazon Lex V2 主控台檢視日誌
  1. 開啟 Amazon Lex V2 主控台 https://https://console.aws.amazon.com/lexv2

  2. 從清單中選擇一個機器人。

  3. 從左側選單中,選擇分析,然後選擇 CloudWatch 指標

  4. CloudWatch 指標頁面上檢視機器人的指標

您也可以使用 CloudWatch 主控台或 API 來檢視您的日誌項目。若要尋找日誌項目,請導覽至您針對別名設定的日誌群組。您可以在 Amazon Lex V2 主控台或使用 DescribeBotAlias 操作找到日誌的日誌串流字首。

您可以在多個日誌串流中找到使用者表達用語的日誌項目。對話中的表達用語在其中一個日誌串流中具有指定前綴的項目。日誌串流中的項目包含下列資訊:

message-version

訊息結構描述版本。

機器人

有關客戶正在互動之機器人的詳細資訊。

messages

機器人傳回給使用者的回應。

utteranceContext

處理此表達式的相關資訊。

sessionState

使用者與機器人之間的對話目前狀態。如需詳細資訊,請參閱了解機器人對話

解釋

Amazon Lex V2 確定的意圖清單可以滿足使用者的表達式。 使用可信度分數來提高對話準確性

interpretationSource

指出槽是由 Amazon Lex 或 Amazon Bedrock 解析。值:Lex | Bedrock

sessionId

進行對話之使用者工作階段的識別符。

inputTranscript

來自使用者的輸入轉錄。

  • 對於文字輸入,這是使用者輸入的文字。對於 DTMF 輸入,這是使用者輸入的金鑰。

  • 對於語音輸入,這是 Amazon Lex V2 將使用者表達式轉換為文字,以叫用意圖或填入槽。

rawInputTranscript

套用任何文字處理之前,使用者輸入的原始文字記錄。注意:文字處理僅適用於 en-US 和 en-GB 地區設定。

轉錄

使用者輸入的潛在轉錄清單。如需詳細資訊,請參閱使用語音轉錄可信度分數來改善與 Lex V2 機器人的對話

rawTranscription

使用語音轉錄可信度分數。如需詳細資訊,請參閱使用語音轉錄可信度分數來改善與 Lex V2 機器人的對話

missedUtterance

指出 Amazon Lex V2 是否能夠辨識使用者的表達用語。

requestId

Amazon Lex V2 為使用者輸入產生的請求 ID。

timestamp

使用者輸入的時間戳記。

developerOverride

指出對話流程是否已使用對話方塊程式碼掛鉤更新。如需使用對話方塊程式碼勾點的詳細資訊,請參閱 整合 AWS Lambda 功能到你的機器人

inputMode

指示輸入類型。可以是音訊、DTMF 或文字。

requestAttributes

處理使用者輸入時使用的請求屬性。

audioProperties

如果啟用音訊對話日誌,且使用者輸入為音訊格式,則 會包含音訊輸入的總持續時間、語音持續時間和音訊中靜音的持續時間。它也包含音訊檔案的連結。

bargeIn

指出使用者輸入是否中斷先前的機器人回應。

responseReason

產生回應的原因。可為下列其中一個:

  • UtteranceResponse – 對使用者輸入的回應

  • StartTimeout – 當使用者未提供輸入時,伺服器產生的回應

  • StillWaitingResponse – 當使用者請求機器人等待時,伺服器產生的回應

  • FulfillmentInitiated – 伺服器產生的回應,即將啟動履行

  • FulfillmentStartedResponse – 伺服器產生的回應,表示已開始履行

  • FulfillmentUpdateResponse – 執行進行中時定期伺服器產生的回應

  • FulfillmentCompletedResponse – 履行完成時,伺服器產生的回應。

operationName

用來與機器人互動的 API。可以是 PutSessionRecognizeUtteranceRecognizeText或 之一StartConversation

{ "message-version": "2.0", "bot": { "id": "string", "name": "string", "aliasId": "string", "aliasName": "string", "localeId": "string", "version": "string" }, "messages": [ { "contentType": "PlainText | SSML | CustomPayload | ImageResponseCard", "content": "string", "imageResponseCard": { "title": "string", "subtitle": "string", "imageUrl": "string", "buttonsList": [ { "text": "string", "value": "string" } ] } } ], "utteranceContext": { "activeRuntimeHints": { "slotHints": { "string": { "string": { "runtimeHintValues": [ { "phrase": "string" }, { "phrase": "string" } ] } } } }, "slotElicitationStyle": "string" }, "sessionState": { "dialogAction": { "type": "Close | ConfirmIntent | Delegate | ElicitIntent | ElicitSlot", "slotToElicit": "string" }, "intent": { "name": "string", "slots": { "string": { "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] } }, "string": { "shape": "List", "value": { "originalValue": "string", "interpretedValue": "string", "resolvedValues": [ "string" ] }, "values": [ { "shape": "Scalar", "value": { "originalValue": "string", "interpretedValue": "string", "resolvedValues": [ "string" ] } }, { "shape": "Scalar", "value": { "originalValue": "string", "interpretedValue": "string", "resolvedValues": [ "string" ] } } ] } }, "kendraResponse": { // Only present when intent is KendraSearchIntent. For details, see // https://docs.aws.amazon.com/kendra/latest/dg/API_Query.html#API_Query_ResponseSyntax }, "state": "InProgress | ReadyForFulfillment | Fulfilled | Failed", "confirmationState": "Confirmed | Denied | None" }, "originatingRequestId": "string", "sessionAttributes": { "string": "string" }, "runtimeHints": { "slotHints": { "string": { "string": { "runtimeHintValues": [ { "phrase": "string" }, { "phrase": "string" } ] } } } } }, "dialogEventLogs": [ { // only for conditional "conditionalEvaluationResult":[ // all the branches until true { "conditionalBranchName": "string", "expressionString": "string", "evaluatedExpression": "string", "evaluationResult": "true | false" } ], "dialogCodeHookInvocationLabel": "string", "response": "string", "nextStep": { "dialogAction": { "type": "Close | ConfirmIntent | Delegate | ElicitIntent | ElicitSlot", "slotToElicit": "string" }, "intent": { "name": "string", "slots": { } } } ] "interpretations": [ { "interpretationSource": "Bedrock | Lex", "nluConfidence": "string", "intent": { "name": "string", "slots": { "string": { "value": { "originalValue": "string", "interpretedValue": "string", "resolvedValues": [ "string" ] } }, "string": { "shape": "List", "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] }, "values": [ { "shape": "Scalar", "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] } }, { "shape": "Scalar", "value": { "interpretedValue": "string", "originalValue": "string", "resolvedValues": [ "string" ] } } ] } }, "kendraResponse": { // Only present when intent is KendraSearchIntent. For details, see // https://docs.aws.amazon.com/kendra/latest/dg/API_Query.html#API_Query_ResponseSyntax }, "state": "InProgress | ReadyForFulfillment | Fulfilled | Failed", "confirmationState": "Confirmed | Denied | None" }, "sentimentResponse": { "sentiment": "string", "sentimentScore": { "positive": "string", "negative": "string", "neutral": "string", "mixed": "string" } } } ], "sessionId": "string", "inputTranscript": "string", "rawInputTranscript": "string", "transcriptions": [ { "transcription": "string", "rawTranscription": "string", "transcriptionConfidence": "number", }, "resolvedContext": { "intent": "string" }, "resolvedSlots": { "string": { "name": "slotName", "shape": "List", "value": { "originalValue": "string", "resolvedValues": [ "string" ] } } } } ], "missedUtterance": "bool", "requestId": "string", "timestamp": "string", "developerOverride": "bool", "inputMode": "DTMF | Speech | Text", "requestAttributes": { "string": "string" }, "audioProperties": { "contentType": "string", "s3Path": "string", "duration": { "total": "integer", "voice": "integer", "silence": "integer" } }, "bargeIn": "string", "responseReason": "string", "operationName": "string" }

日誌項目的內容取決於交易的結果,以及機器人和請求的組態。

  • missedUtterance 欄位是 true,則 intentslotsslotToElicit 不會顯示在輸入中。

  • 如果音訊日誌已停用或 inputDialogMode 欄位是 Text,則 s3PathForAudio 欄位不會出現。

  • 只有在您為機器人定義回應卡片時,才會顯示 responseCard 欄位。

  • 只有在請求中指定了請求屬性時,才會顯示 requestAttributes 對映。

  • 只有在 AMAZON.KendraSearchIntent 提出搜尋 Amazon Kendra 索引的請求時,才會出現 kendraResponse 欄位。

  • 在機器人的 Lambda 函數中指定替代意圖時, developerOverride 欄位為 true。

  • 只有在請求中指定了工作階段屬性時,才會顯示 sessionAttributes 映射。

  • 只有在您設定機器人傳回情緒值時,才會顯示 sentimentResponse 映射。

注意

即使 messageVersion 中沒有對應的變更,輸入格式也可能變更。如果出現新欄位,您的程式碼不應擲出錯誤。