question

Scott Leonard avatar image
Scott Leonard asked

Help with partial intents

I'm having difficulty in getting my skill to property deal with the response prompt from a partial intent. For example, for an utterance like "turn on the {light}" they user might just say "turn on the" (or they give an invalid {light} value). I see the missing slot and respond with a prompt for the {light}. When they respond with [b]just the light name[/b], I will get a different intent being called. It's like the simple response to the prompt is getting reevaluated as a new full intent. The response prompt sets shouldEndSession to false when the user is prompted for the slot name. Is there something I'm not understanding with the way this should work? Does the user have to restate the entire utterance in this case or should they just be able to say a word or two to fill the slot? Thanks, Scott
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
The Alexa service is not magic. It has no state whatsoever. When the user says something, it tries to match it to an utterance. It then passes the skill the best matching intent and the best matching values for the slots on that intent. That's it. It does not remember what you said last time. So there is no way it can exhibit the behavior you want. If you want it to work that way, you have to engineer your skill to work that way. For example, in Starlanes a very common intent is along the lines of "drop ". Alexa is particularly bad at getting both slots. So I have all sorts of complicated logic to work out if only zero or one of the slots is filled, and which one. As with you, I prompt the user to repeat just the missing value. However, when I do that, I set an internal state so I can remember that I asked them to. Then, I have a "numberonly" intent, and a "droneonly" intent. If my skill is informed that one of these is triggered, and the flag has been set that says that I've asked them to, I behave appropriately. Otherwise I say "WTF?" (more or less). It adds complexity to the program. And having those extra intents in there sometimes skew the results when the user is trying to say something else. If this was VoiceXML, you could control at each point what could be said. But that's not how Amazon designed Alexa. This is the best you can do with what they've given us.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Scott Leonard avatar image
Scott Leonard answered
That makes sense and is what I was afraid of. It would be nice if there were a way to have a default intent that could be used to handle the case where someone is just speaking the remainder of the partial intent. It won't match any full utterances, but I could use stored session info to complete the final action. I think it would make sense if the shouldEndSession flag is set to false. Message was edited by: Scott Leonard
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.