As you create more Alexa skills, you can add advanced features to deliver a more conversational experience to your users. We recently updated the decision tree sample skill to use dialog management and entity resolution. Previously the skill asked a set of yes/no questions. Depending upon the answer, Alexa would ask a follow-up question. Once the user answered the last question, the skill would recommend a vocation to the user.
With dialog management, your skill can engage in a multi-turn conversation with the customer to collect a set of necessary slots and then do something with it. As a result, the experience becomes more conversational. The decision tree uses the values to make a look-up key, which it passes to a map to determine what vocation to recommend. The decision tree collects the following four custom slots:
Below is a sample of how the user would interact with the skill:
Marty: Alexa, open decision tree.
Alexa: Welcome to decision tree. I can find the best job for you. Are you ready to start your career or be a couch potato?
Marty: I want to start my career.
Alexa: Which phrase best describes your thoughts about money: there's nothing more important, not a top priority, or I don't care about money.
Marty: There's nothing more important.
Alexa: Would you say that you are an introvert or an extrovert?
Marty: I am an introvert.
Alexa: Between animals and people, which do you prefer?
Alexa: If you saw blood, would you scream or shrug?
In addition to dialog management, the skill has been updated to use entity resolution. This adds flexibility to the interaction. For example, if the user says "people" that will resolve to "human," which is the value we need when we build our look-up key.
Once filled, the values are appended to form a look-up key. For example, very-extrovert-high-people would indicate the user is an extrovert, desires a high salary, is totally fine working with blood, and prefers animals over people. The look-up key is then passed to slotOptionsMap, which returns an index. Passing the index to the options array will return the vocation that very-extrovert-high-people is mapped to.
In this case, the user matched with Doctor. The skill will respond with a proactive confirmation of what it heard as well as the recommendation. For example, “So you are an extrovert looking for a high-paying job, prefers people and doesn't mind blood. You should consider being a doctor.”
One nice thing about this skill sample is that you can easily make it your own. For example, if you wanted to recommend video games, you could replace the match criteria with things like genre, ageRating, numberOfPlayers, and story. Then you would need to define slot values for each. For example, possible genres might be: simulation, action, or role-playing.
Next, you would build your interaction model using dialog management to delegate the slot collection to Alexa to capture the required slots. Last, you would need to supply your own data by replacing the jobs with video game titles and redoing the map. For example role-playing-teenager-single-space might return index 67 and options would be Mass Effect.
Have fun experimenting with this sample skill! I’m looking forward to seeing what recommendation skills you build. If you publish one, let me know via Twitter at @sleepydeveloper.
Get Started with Dialog Management
For more information about dialog management, check out the following resources:
Build Engaging Skills, Earn Money with Alexa Developer 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, UK and Germany. Learn more about our rewards program and start building today.