Alexa Dynamic Slots
This post was first published on the Alexa developer blog.
No, you cannot add slots dynamically. Maybe a very short answer but that's the fact. Amazon doesn't have default slots as well to match your requirement. If it is other locations like the city then there are built-in slots available like 'AMAZON.City'. Here only possible way is to add as much as possible locations in your custom slot. For example, if the intent has two slots with priorities 1 and 2, AWS Amazon Lex first elicits a value for the slot with priority 1. If multiple slots share the same priority, the order in which Amazon Lex elicits values is arbitrary.
Conversations are not scripted. When you ask someone a question, the person may or may not provide all of the information that was asked. They may even provide more. When designing your Alexa skill, it’s important to start with this conversation in mind. In an Alexa skill, a dialog with the user is a conversation with multiple turns in which Alexa asks questions and the user responds with the answers.
For example, let’s say you built a skill that could book a flight, and it asked the user, “Where are you going?” to which the user replies, “I’m going to Tokyo next Tuesday.” Your skill should recognize that the user gave you more information than what was asked. If you follow up by asking, “When are you leaving?” the user will be frustrated since they’ve already told you when. On the other hand, if your skill asks, “When and where are you going?” and user replies, “I’m going to Tokyo.” Then your skill should recognize that it only received one piece of the necessary information and ask, “Where are you going?” as a follow-up question.
There are also many ways to express the same idea, so you should think about the different words you might use when asking a question or the different ways Alexa could respond. For example, if you wanted to ask about the weather, you might use different words like “downpour,” “shower,” “storm,” and “rainstorm” to refer to the “rain.” This ability to use different words occurs naturally in everyday conversation. When incorporated into Alexa skills, you can allow users to have conversations in the way that comes naturally to them, creating an engaging voice experience. Entity resolution allows you to map synonyms to your slot values so you can add more variation into how the user may fill slots.
Dialog management makes these types of conversational voice experiences possible. We’ve shared several best practices on the topic over the last several months. Combined with entity resolution, you can easily disambiguate synonyms that have resolved to more than one value that you have defined. If you’re ready to enhance your Alexa skills using dialog management to enable multi-turn conversations, check out our latest roundup of tutorials, sample skills, and blog posts to get started.
Tutorial: Enable Multi-Turn Dialog with the Decision Tree Sample Skill
The decision tree sample skill is a great way to practice using dialog management and entity resolution. Previously this sample skill only allowed Alexa to ask yes/no questions. Depending on the answer, Alexa would ask a follow-up question. By applying dialog management, Alexa can ask more engaging questions to collect a set of necessary slots and deliver a more conversational experience to your users. Check out this post to learn more about how you can use the updated sample skill template for a basic decision tree skill.
Decoding Dialog Management with the Pet Match Skill
Pet Match is another sample skill you can use to learn the ins and outs of dialog management.
By applying dialog management, Pet Match gains the flexibility to collect the slots, all at once in a one-shot utterance and one or many slots in a multi-turn sequence without writing any code to manage keeping track of which required slots are still missing. This skill teardown will walk you through activating dialog management in your voice user interface, and the blocks of code in the backend that hook into the dialog management state machine and delegate collection back to Alexa.
Taking Control of the Dialog Management State Machine
Alexa Dynamic Slots App
Dialog management greatly reduces the necessary coding required to reprompt for missing slot values. From your interaction model, you mark which slots are required and provide a set of prompts and utterances for each required slot. From your backend, you delegate the collection of the slots to Alexa. Each interaction between the customer and Alexa during dialog management allows to you hook into the state machine and perform your own logic. Check out this post to discover how you can leverage dialog management to delegate the state management to Alexa.
How to Enable Alexa to Switch Context Mid-Conversation
When you have a natural conversation with another person, you might find the conversation can take different directions. Therefore, the context of the conversation can change quite rapidly. The previous iteration of dialog management required the user to complete the dialog to switch context to a different intent, but recent updates now make it possible to switch context between intents part-way through. Read the post to learn more about how you can enable Alexa to maintain context while switching between intents.
Using Dialog Management to Capture A and B or C Slots
For more advanced multi-turn conversations, you can lean on dialog management to simplify collecting a set of required slots that an intent needs to perform its task for the user. This postwalks you through how you can use dialog management to pull a set of required slots from your user based on a condition.
Eliciting Slots Dynamically with Dialog Management
Because dialog management requires you to predefine a set of prompts for each required slot, it seems like it wouldn’t be possible to dynamically change Alexa’s response. However, you can use the dialog management state machine to override prompts and determine which slot is going to be prompted for next, including optional slots. This post walks you through how to accomplish dynamic slot elicitation by overriding predefined prompts and elicited slots with dialog management, using a skill that recommends products as the example.
Build Engaging Skills, Earn Money with Alexa Developer Rewards
Alexa Dynamic Slots Games
Using dialog management, you can build more engaging skills that customers love, and potentially earn rewards. Every month, developers can earn money for eligible skills that drive some of the highest customer engagement. Developers can increase their level of skill engagement and potentially earn more by improving their skill, building more skills, and making their skills available in in the US, the UK and Germany. Learn more about our rewards program and start building today.