Utterances to test lambda function not working (but lambda function itself executes)

自闭症网瘾萝莉.ら 提交于 2019-12-12 01:51:02

问题


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

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: 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.


回答1:


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

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'



来源:https://stackoverflow.com/questions/38108542/utterances-to-test-lambda-function-not-working-but-lambda-function-itself-execu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!