Alexa Dynamic Slots
This post was first published on the Alexa developer blog.
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.
Alexa has many built-in slot types (we call them system defined slots) which can be used in utterances. System defined slots have names starting with AMAZON, so to add those, you can simply start typing AMAZON. And it will show you the available system defined slots. 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. When you stay at Best Western Plus Prien Lake Inn & Suites in Lake Charles, you'll be in Alexa Skill Dynamic Slot Values the Alexa Skill Dynamic Slot Values suburbs and convenient to Prien Lake Mall and Imperial Calcasieu Museum. This hotel is within close proximity of McNeese State University and Children's Museum Lake Charles.
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
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
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.
Package Description
DYNAMIC EFFECTS END OF LIFE
With the impending release of 0.7.x work on dynamic effects will be limited to bug fixes and will NOT be made comaptible with versions greater than 0.7.0. Dynamic Active Effects (DAE) has been released (and is still beta) but does work with 0.7.1+. Please use that instead going forwards.
- Dynamic effects lets you apply item based effects to your character or targeted tokens, adding/decreasing attack/damage bonuses, increasing/decreasing maximum hit points, changing alignment, in fact almost any field on the character sheet can be adjusted by dynamiceffects.
- The module is not dnd5e dependent, although there is additional support for dnd5e.
- All of the changes exist in game only, the saved version of the actor remains unchanged, with the excpetion that active effect modifiers are stored in a flag so they can be reapplied when the game reloads.
You must be on DND5e 0.95 or later if using this module with dnd.
Dynamiceffects changes the way saving throws are rolled for dnd5e and the standard ability saving throws. The save bonus for ability saves (as updated by dynamiceffects) is used rather than mod+proficiency. This change will be removed for foundry 0.7.x
Alexa Dynamic Slots App
Effects are created/edited from the item sheet which has an additional tab, Effects.
Please see the Readme.md and Overview.md for more information, there are lots of non-obvious behaviours in dynamiceffects and reading those documents will help you get better use of the module.
Change Log
0.5.14 fix bug when importing characters (json/dnd beyond) and incompatibiltiy with better npc sheet.
0.5.15 Added DynamicEffects.setTileVisibility() function
0.5.16 fix another bug on empty fields. Only add '+' on string effects on second and subsequent fields
Alexa Dynamic Slots Poker
0.5.17 Included PR from @shads2 that allows and additional parameter to teleportToToken being the scene name. This allows you to reuse token names on different scenes.
0.5.18 added moveToken function (similar to teleportToToken, but just deletes and recreates the token).
0.5.19 Cleaned up the presentation of skills abilities to display the list of available abilities - rather than a text field which could break actors quite badly. Removed unusable check_all specifier. Cleaned up initiative specifiers a bit. Put back Skills All to add a numeric bonus to any skill roll.
0.5.20 Added Dynamiceffects.fixAbilities to correct problems with actors whose skills ability field was set incorrectly.
0.5.21 Restored compatibility with effects changing spell slots.
0.5.22 undid breakage for pf1/pf2 - still does not work all that well - but does not fail completely
0.5.23 fix for spellDC calculation - thanks @kiovml / removed some debug that was left behind
0.5.24 improved handling of numeric fields
0.5.25 changed player can see effects to none/view/edit. If the player is trusted and edit is true players can edit dynamiceffects details.
added di.all, dr.all and dv.all effects
0.5.26 fixed error in effects editor for damage vulnerabilities.
v0.5.27 Added macro.execute active effect - see not below
Improved actorEffect chat card - note macro effects do not (currently) show up as active effects.
incorporated @kiov PR
v0.5.28 added PRs from @kiov and @ohporter
Put back convert loot to equipment function.
v0.5.29 remove dependency on furnace for dynamiceffects to load
v0.5.30 added armor proficiencies as a drop down list
v0.5.31 remove extra debug line left in
v0.5.32 allow trusted players to edit all fields of an item
0.5.33 foundry 0.5.6 compatibile
v0.5.34 support text duration fields (uses item.data.data.duration) for scheduleing active effect removal if about-time installed.
Do not schedule removal if no duration is present.
v0.5.3.39 fixes for duration fields (multiple iterations).
Fix for duplication of bonuses application and inability to change flag fields.
Patch dnd5e to use ability.save rather than ability.mod + prof for rolling saving throws.
v0.5.5.41 fixed various oddities when updating actors due to a previous patch.
0.5.5.43-0.5.45 v0.9 compatibility, update ko.json from kr.json YOU MUST BE ON DND 0.9 to use this version
v0.5.48 fix for some aargument expressions not being properly evaluated when passed as active effects
update ko.json
v0.5.51 fix for skills calculations which were overwritten in 0.91
fix for passive skills bonus to be applied at the correct point
fix for pact slots
fix for other module flags - only track/keep game system flags.
added baseData() - actor.baseData() returns the unmomidifed character data (i.e. before dynamicEffects is applied) only useful to macro writers
Added Overview.md which covers some of the internals of dynamiceffects, what passive/active effects are and has a couple of sample macros
v0.5.53/0.5.52 Fix for @Lookups getting broken by dynamiceffects
fix for tab selection defaulting back to description - thanks @sdenec
put back spell slots/spell uses
For most cases the only spell fields you can usefully alter with dynamiceffects is override and that can only be set to a value. For more info have a look at Overview.md.
0.5.56 added weapon proficiences as drop down
v0.5.57 fix for proficiency value being correctly added to the saves/skills/checks
v0.5.58-0.5.63 added conditions as active effects - requires cub to do anything
Alexa Dynamic Slots Games
v0.5.64 put back see invisible experimental patch
v0.5.65 fix for double adding of saving throw global bonus
vb0.5.66 add chinese language support
v0.5.67-v0.70
Added support for conditions as effects. Requires combat-utility-belt v0.1.2 or later and will use that to apply conditions to tokens.
0.5.71-0.5.75 bug fixes for saving throws, conditions, module checking and other omissions in previous releases
V0.5.76-80 various bug fixes:
changes for premade items and macros - cleaned up.
fix for tokens that are invisible and have no actor and experimental control visible mod turned on.
put back default dnd5e conditions for condition immunities
merge pt-BR
pass total damage to macros so they know what was applied. If a single token is target the actual damage is passed.
fix self targeting issues
added fr.json
improvements to invisiable token management - seems to work fine now - may even remove experimental tag.
0.5.81 Fix for item macros
v0.5.82 Added @unique tag to item macros to allow saving of state between 'on' and 'off' calls to macro
Translations:
日本語 - Thanks to @BrotherSharp
kr - Thanks to @KLO
中文 - Thanks to @xtlcme
Tagged Categories
Available Versions
Version 0.5.39
Version 0.5.95