The intent_request
是从 Lex 到 Lambda 函数的传入“请求”或“事件”。它保存有关用户输入和 Lex 机器人对该输入的处理的所有必要信息(触发某些意图、填充某些槽、确认等)
这应该是您正在寻找的文档。
Lambda 函数输入事件和响应格式 https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html:
本部分介绍 Amazon Lex 向 Lambda 函数提供的事件数据的结构。使用此信息来解析 Lambda 代码中的输入。它还解释了 Amazon Lex 期望 Lambda 函数返回的响应格式。
这是事件/请求格式:
{
"currentIntent": {
"name": "intent-name",
"slots": {
"slot name": "value",
"slot name": "value"
},
"slotDetails": {
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
},
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
}
},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)"
},
"bot": {
"name": "bot name",
"alias": "bot alias",
"version": "bot version"
},
"userId": "User ID specified in the POST request to Amazon Lex.",
"inputTranscript": "Text used to process the request",
"invocationSource": "FulfillmentCodeHook or DialogCodeHook",
"outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request",
"messageVersion": "1.0",
"sessionAttributes": {
"key": "value",
"key": "value"
},
"requestAttributes": {
"key": "value",
"key": "value"
}
}
The slots
里面找到数据currentIntent
那是在这整体的内部intent_request
目的。这就是您看到代码的原因:intent_request['currentIntent']['slots']
因此,要获取会话属性,您可以在这里找到它们:intent_request['sessionAttributes']
同样非常有用的是确切的用户输入文本:intent_request['inputTranscript']