2
votes

How can I make Alexa prompt me (e.g. “You want weather for which city again?”) if I missed a parameter (slot i.e. city_name) in my utterance?

I am making a skill which tells me weather of a city. I have utterances and it works alright, but when I don't define a city name (city_name is also my only slot in my intent) then it directly goes to stop intent and gives my message "Alexa cannot help you with this".

In my slot (city_name) I've even checked "Is this slot required to fulfill the intent?" and have filled Alexa prompts and user utterances but still it doesn't work.

2

2 Answers

0
votes

Use alexa dialogs. Dialog automatically fills all the required slots by reprompting the user for the slot value that he has missed. A dialog has 3 states, STARTED, IN_PROGRESS, COMPLETED. Dialog state will be completed only if you have all the required slot values filled. Watch the tutorial here

0
votes

You can use different Dialog interface directives to ask the user for the information you need to fulfill their request. When ever there is an user interaction with your skill, you will get a request at your backend with the mapped intent and filled(or unfilled) slots. Even if you use dialog model and has filled in all the utterances for each slot, you will have to respond back with an appropriate directive to continue.

There are three ways in which you can handle a dialog model.

1. Delegating to Alexa
You can use the Dialog.Delegate directive to let Alexa determine the next step in the dialog and uses the prompts that you have defined in the dialog model to elicit slot values, confirm slot values, or confirm the entire intent.

If you have unfilled slots just return a delegate directive, Alexa will use the prompts defined in the interaction model to fill that slot. As long as the dialogState property is not COMPLETE you can continue delegating to Alexa.

Once the conversation is complete, the incoming IntentRequest has a dialogState of COMPLETED. All required information is now available in the intent's slot values.

Note: With Dialog.Delegate directive you cannot send outputSpeech or reprompt from your code. Instead those defined in interaction model will be used. And the COMPLETED status is only possible when you use Dialog.Delegate.

2. Control the Dialog
In each turn of the conversation you can take the control and ask for what you need rather than delegating it to Alexa. This is useful especially when you want slots to be filled a particular order or you want to confirm slots as you go or your slot's "mandate" property is dynamic in nature and so on.

You can use Dialog.ElicitSlot directive to ask for a particular slot, Dialog.ConfirmSlot to confirm a particular slot and Dialog.ConfirmIntent to confirm an intent itself.

3. Combining both
When you receive an intent request you can return a delegate directive or any other directive as you wish. Even if you delegate, at any point you can take over the dialog rather than continuing to delegate to Alexa.

More on the different directive here

Sample Interactions:
1. Using delegate directive here
2. Using ElicitSlot directive here
3. Using ConfirmSlot directive here
4. Using ConfirmIntent directive here