We recently launched dynamic entities, which can help you personalize Alexa skill experiences by adapting your interaction model at run time without edits, builds, or re-certification. Given dynamic entities offer a new authority source, custom slot values, and a new directive, there's a lot to take in. But where do dynamic entities really shine and how can you best leverage them? I'm excited to share a few use cases where you can leverage dynamic entities to personalize and improve the user experience of your Alexa skill.
Before you get started with dynamic entities, you'll need a solid foundation in the form of your language model. Just simply throwing all of your slot values into dynamic entities and leaving a skeleton in your static model is going to leave you hearing error messages and failures. Your language model defines the interactions Alexa expects to fulfill with your skill and dynamic entities only exist for a short duration. If you leave your static language model empty, then there isn't much for Alexa to train against and therefore you'll hear more error instances where nothing quite matches. Let's take a look at an example.
A trivia skill has an intent to handle user guesses and answers called AnswerIntent. The intent accepts a single slot type of ANSWER. This skill surfaces new questions weekly and dynamic entities will allow me to fill in answers at run time. This is exactly what I was hoping for so I only load a single value in the ANSWER slot since I intend to update so frequently. My static catalog looks something like this:
{
"name": "ANSWER",
"values": [
{
"name": {
"value": "pizza"
}
}
]
}
Except in testing, none of my responses are routing to the AnswerIntent. The single value I provided is successful, but I can't consistently resolve answers for trivia questions.
Define a variety of slot values to reflect the dynamic values you are uploading. If you have a small set of sample utterances and slots values, then there isn't much for Alexa to train against and you'll see more instances of mismatched intents. My skill is a master of “pizza” but not much else.
Instead of that single value, I loaded the ANSWER slot type in my language model with three weeks worth of slot values of a variety of lengths (one word, two word, and three word) and suddenly my AnswerIntent is capturing responses more consistently.
Aim to have only one single word intent. These are intents where there is only a single slot value as the sample utterance.
{
"name": "AnswerOnlyIntent",
"slots": [
{
"name": "answer",
"type": "ANSWER"
}
],
"samples": [
"{answer}"
]
}
Combine sessionAttributes for the the state the user is at in the skill, dynamic entities, and the intent context to determine where to route the user. For my trivia example, I allow users to select a trivia round by number that slots to the SelectRound intent. Both AnswerIntent and SelectRound intent potentially accept numbers as valid slot values. To avoid confusion with my ANSWER slot type, once a user starts a game I can store a state in the sessionAttributes to indicate a game is in progress and route number answers to the AnswerIntent handler rather than the SelectRound handler.
Use slot-based grammars where you find yourself otherwise creating similar or overlapping intents. My trivia skill allows users to select a category. Rather than have an intent for each category I can use a CATEGORY slot type to reflect the user's choice. Slot-based grammars allows me to simplify repeating phrases in my utterances such as “who,” “what,” “when,” and “where.”
For a generic example: The InformationIntent includes utterances: "{interrogative} did {event} take place?", "{interrogative} is {event}", and "{interrogative} {event}"
Static slot values customize and train a model, dynamic slot values customize a point in time interaction. Dynamic entities only exist at runtime and only for a portion of an interaction. Keeping with the trivia skill example, one week I have a category of “Trees” and want to capture “fur” as a synonym for “fir tree”. I can have that synonym only exist dynamically so that when I pivot to a “Fabrics” category the “fur” value isn't trying to route to a tree.
However, I want “fur” and “fir” to exist as values for my ANSWER slot type for future trivia interactions. Adding those values to my static model ensures the model is trained to expect these types of answers.
Now that I have a good foundation in my language model to start building against, let's look at how to get the most out of dynamic entities for my trivia skill.
Fresh and frequently updated content keeps users coming back to a skill. There is both the allure of the unknown in the form of “What is coming this week?” as well as the idea that the interaction can't be exhausted in the short term. However, any change to the language model means going through certification. This ensures that the experience is consistent and reliable for users across releases, but certification also takes time. As exciting as trees are, I doubt my players really want to answer the same tree trivia questions for weeks on end.
To create a good balance of dynamic and static content for this use case:
For the frequent content updater, dynamic entities are a great way to supplement the static language model and increase the chances of matching user utterances to the intended result rather than a possible result in a sea of slightly correct answers.
A use case that our previous blog touched on was using dynamic entities for personalization. Two forms of personalization are user specific and state specific:
There are many more ways to leverage dynamic entities with other features in Alexa to create language models and experiences that are tailored to your users and their usage. The key takeaways are to build a language model that is robust and to not look at dynamic entities as a way to replace the language model but as a way to augment it.