As you create more 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:
personality | salaryImportance | bloodTolerance | preferredSpecies |
introvert | very | high | human |
extrovert | somewhat | low | animal |
unimportant |
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 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?
MARTY
People
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[67] 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:
- Developer Documentation for Dialog Management
- On-Demand Webinar: Advanced Voice Design Techniques
- Pet Match Sample Skill on GitHub
Source: Alexa Developer Blog