I'm playing with the Amazon Alexa SDK and I'm programming my first skill. My goal is to programm a dialog like this:
- Where do you live?
- How long have you been living there?
The problem is that I can answer the question number one with keywords from the second question and then Alexa assumes that I answered to the second question and will provide me the answer for question number two. Is there a way to prevent this?
I know I could use session attributes but this looks rather hacky to me...
Thanks for your help =)
PS: I'm using flask-ask for my Alexa Skill.
There are a few ways you could structure this dialog. The first way, similar to what you're doing currently, is to use a series of single turn dialogs. My guess is that you're not using the right slot types in your existing interaction model, which is why the wrong intents are matched.
If I were using a single turn approach, I'd have two intents.
The first intent would match responses to the question "Where do you live?"
The second would match responses to the question "How long have you been living there?"
A different approach altogether (and one that I'd likely use in this situation) would be to structure the conversation using a Multi-turn Dialog. This approach would define a single intent, with multiple required slot values.
One intent, with two required slots. If the user says I live in Boston,
Utterance 1
will match, and Alexa will respond with a prompt asking for the number of years they've lived there. Look into Multi-turn Dialogs for more details.