从AWS Lambda函数获得对AWS Lex bot的响应会出错吗? [英] Getting response from AWS Lambda function to AWS Lex bot is giving error?

查看:90
本文介绍了从AWS Lambda函数获得对AWS Lex bot的响应会出错吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个AWS Lex机器人,并且正在从该bot调用一个lambda函数.测试lambda函数时,我得到了正确的响应,但是在机器人程序中,我得到了以下错误:

I have created one AWS Lex bot and I am invoking one lambda function from that bot. When testing the lambda function I am getting proper response but at bot I am getting below error:

发生错误:收到来自Lambda的无效响应:不能 构造IntentResponse的实例:无字符串参数 从字符串值反序列化的构造函数/工厂方法 ('2017-06-22 10:23:55.0'),网址为[Source:"2017-06-22 10:23:55.0";线: 1,列:1]

An error has occurred: Received invalid response from Lambda: Can not construct instance of IntentResponse: no String-argument constructor/factory method to deserialize from String value ('2017-06-22 10:23:55.0') at [Source: "2017-06-22 10:23:55.0"; line: 1, column: 1]

不确定,哪里出了问题以及我在哪里失踪.有人可以帮我吗?

Not sure, what is wrong and where I am missing. Could anyone assist me please?

推荐答案

上述问题的解决方案是,我们需要确保在AWS lex chat bot上使用的lambda函数返回的响应应采用以下格式:

The solution to above problem is that we need to make sure response returned by lambda function, to be used at AWS lex chat bot should be in below format:

{
"sessionAttributes": {
"key1": "value1",
"key2": "value2"
...
 },
  "dialogAction": {
"type": "ElicitIntent, ElicitSlot, ConfirmIntent, Delegate, or Close",
Full structure based on the type field. See below for details.
}
}

通过这种方式,聊天机器人需要DialogAction和相应的元素来处理消息,即IntentResponse.

By this, chat bot expectd DialogAction and corresponding elements in order to process the message i.e. IntentResponse.

参考: http://docs .aws.amazon.com/lex/latest/dg/lambda-input-response-format.html

这篇关于从AWS Lambda函数获得对AWS Lex bot的响应会出错吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆