Amazon web services Amazon Lex与AWS Lambda的集成
我使用Alexa Skills Kit已经有一段时间了,我的代码部署在用Node Js编写的AWS Lambda中。现在我想通过AmazonLex服务将聊天机器人集成到其中。因此,我能够使用Amazon Alexa和Amazon lex控制我的设备。我的问题是,如果我在AmazonLex中使用与我在Alexa技能中相同的意图和插槽名称,AWS Lambda代码是否会开箱即用?或者我必须修改AWS Lambda代码以适应AWS Lex?您必须适应Lex和Alexa之间的差异。最显著的区别是请求和响应格式 应注意的显著差异:Amazon web services Amazon Lex与AWS Lambda的集成,amazon-web-services,aws-lambda,alexa,aws-lex,Amazon Web Services,Aws Lambda,Alexa,Aws Lex,我使用Alexa Skills Kit已经有一段时间了,我的代码部署在用Node Js编写的AWS Lambda中。现在我想通过AmazonLex服务将聊天机器人集成到其中。因此,我能够使用Amazon Alexa和Amazon lex控制我的设备。我的问题是,如果我在AmazonLex中使用与我在Alexa技能中相同的意图和插槽名称,AWS Lambda代码是否会开箱即用?或者我必须修改AWS Lambda代码以适应AWS Lex?您必须适应Lex和Alexa之间的差异。最显著的区别是请求和响
sessionattribtue
和slot
的格式和传递之间的主要差异李>
slotTypes
,Alexa还没有使用:AMAZON.EmailAddress、
、AMAZON.Percentage
、AMAZON.PhoneNumber
、AMAZON.SpeedUnit
和AMAZON.WeightUnit
。()inputTranscript
传递完整的用户输入。Alexa没有分辨率
,但使用从输入中提取的原始数据填充实际插槽值slotType
设置了同义词,则Lex将自动解析插槽值Alexa请求示例: 请求示例:
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.[unique-value-here]",
"application": {
"applicationId": "amzn1.ask.skill.[unique-value-here]"
},
"attributes": {
"key": "string value"
},
"user": {
"userId": "amzn1.ask.account.[unique-value-here]",
"accessToken": "Atza|AAAAAAAA...",
"permissions": {
"consentToken": "ZZZZZZZ..."
}
}
},
"context": {
"System": {
"device": {
"deviceId": "string",
"supportedInterfaces": {
"AudioPlayer": {}
}
},
"application": {
"applicationId": "amzn1.ask.skill.[unique-value-here]"
},
"user": {
"userId": "amzn1.ask.account.[unique-value-here]",
"accessToken": "Atza|AAAAAAAA...",
"permissions": {
"consentToken": "ZZZZZZZ..."
}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "AxThk..."
},
"AudioPlayer": {
"playerActivity": "PLAYING",
"token": "audioplayer-token",
"offsetInMilliseconds": 0
}
},
"request": {}
}
{
"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"
}
}