断言无法测试lambda函数(但lambda函数本身会执行) [英] Utterances to test lambda function not working (but lambda function itself executes)

查看:141
本文介绍了断言无法测试lambda函数(但lambda函数本身会执行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个lambda函数,该函数以名为 GetEvent 的意图成功执行,该意图返回特定的字符串。为了测试目的,我为此目的创建了一种发音(一种表达很简单,不需要调用该技能的任何可选插槽),但是当使用服务模拟器以这种表达方式对lambda函数进行测试时, GetEvent 我遇到了一个lambda响应,内容为响应无效 。交互模型如下所示:

I have a lambda function that executes successfully with an intent called GetEvent that returns a specific string. I've created one utterance for this intent for testing purposes (one that is simple and doesn't require any of the optional slots for invoking the skill), but when using the service simulator to test the lambda function with this utterance for GetEvent I'm met with a lambda response that says "The response is invalid". Here is what the interaction model looks like:

#Intent Schema

   {
   "intents": [
     {
       "intent": "GetVessel",
       "slots": [
         {
           "name": "boat",
           "type": "LIST_OF_VESSELS"
         },
         {
           "name": "location",
           "type": "LIST_OF_LOCATIONS"
         },
         {
           "name": "date",
           "type": "AMAZON.DATE"
         },
         {
           "name": "event",
           "type": "LIST_OF_EVENTS"
         }
       ]
     },
     {
       "intent": "GetLocation",
       "slots": [
         {
           "name": "event",
           "type": "LIST_OF_EVENTS"
         },
         {
           "name": "date",
           "type": "AMAZON.DATE"
         },
         {
           "name": "boat",
           "type": "LIST_OF_VESSELS"
         },
         {
           "name": "location",
           "type": "LIST_OF_LOCATIONS"
         }
       ]
     },
     {
       "intent": "GetEvent",
       "slots": [
         {
           "name": "event",
           "type": "LIST_OF_EVENTS"
         },
         {
           "name": "location",
           "type": "LIST_OF_LOCATIONS"
         }
       ]
     }
   ]    
}

适当的自定义技能类型语法,并且

With the appropriate custom skill type syntax and,

#First test Utterances
GetVessel what are the properties of {boat}

GetLocation where did {event} occur

GetEvent get me my query

当给Alexa发话让我查询时,lambda响应应该像执行中那样输出字符串。我不确定为什么不是这种情况;这是我使用Alexa Skills Kit进行的第一个项目,所以我很新。我对lambda函数,意图架构和话语如何组合在一起不了解吗?

When giving Alexa the utterance get me my query the lambda response should output the string as it did in the execution. I'm not sure why this isn't the case; this is my first project with the Alexa Skills Kit, so I am pretty new. Is there something I'm not understanding with how the lambda function, the intent schema and the utterances are all pieced together?

UPDATE :谢谢在AWSSupport的帮助下,我将问题缩小到json请求中将新会话标记为 true 的区域。为了使语音正常工作,必须将其设置为 false (在手动输入json请求时有效,在lambda执行期间也是如此)。为什么会这样呢? Alexa是否真的关心调用期间是否是新会话? 我已经在几天前将其交叉发布到了亚马逊开发者论坛,但尚未得到某人的回应。

UPDATE: Thanks to some help from AWSSupport, I've narrowed the issue down to the area in the json request where new session is flagged as true. For the utterance to work this must be set to false (this works when inputting the json request manually, and this is also the case during the lambda execution). Why is this the case? Does Alexa really care about whether or not it is a new session during invocation? I've cross-posted this to the Amazon Developer Forums as well a couple of days ago, but have yet to get a response from someone.

推荐答案

这可能已更改,也可能未更改-我上次使用服务模拟器时(在撰写本文时大约两周前),它有一个非常严重的错误,该错误会导致将请求映射到您的第一个/错误意图,无论实际的模拟语音输入如何。
因此,即使您输入 wafaaefgae 之类的随机内容,它也只会尝试将其映射到您定义的第一个意图,而不会为可能导致出乎意料的结果。

This may or may not have changed -- the last time I used the service simulator (about two weeks ago at the time of writing) it had a pretty severe bug which would lead to requests being mapped to your first / wrong intent, regardless of actual simulated speech input. So even if you typed in something random like wafaaefgae it simply tries to map that to the first intent you have defined, providing no slots to said intent which may lead to unexpected results.

您的问题很可能与此相关,因为您在样本话语中没有使用任何插槽,因此触发了相同的意外/错误行为

Your issue could very well be related to this, triggering the same unexpected / buggy behavior because you aren't using any slots in your sample utterance

在花更多的时间调试它之前,建议您使用实际的回显或 https ://echosim.io/ -通过实际语音进行的交互按预期工作,与模拟器不同

Before spending more time debugging this, I'd recommend trying the Intent using an actual echo or alternatively https://echosim.io/ -- interaction via actual speech works as expected, unlike the 'simulator'

这篇关于断言无法测试lambda函数(但lambda函数本身会执行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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