Adding Dialogs and Prompts in the Interaction Model

Up to this point, we’ve been working with the interaction model as a way to match intents with sample utterances, possibly with slots and custom types. That is, we’ve focused on a subset of the interaction model known as the language model, as defined within the languageModel property.

But the language model is only one of three parts of a skill’s interaction model. In addition to the language model, the interaction model can also define dialog rules and prompts. These are represented in the interaction model JSON structure in the dialog and prompts properties, which are peers to the languageModel property. The following high-level sample of interaction model JSON shows these three properties together:

 {
 "interactionModel"​: {
 "languageModel"​: {
 ...
  },
 "dialog"​: {
 ...
  },
 "prompts"​: [
 ...
  ]
  }
 }

Dialog rules, defined within the dialog property, ensure that the values given in slots are valid and complete. This includes elicitation, validation, and confirmation. Elicitation ensures that all slot values are provided to a handler and, if not, then the user is asked to provide the missing information. Validation ensures that the values given fit what is expected for a slot. And confirmation ensures that the skill heard everything correctly by asking the user to confirm the given values before the skill takes action on the intent.

As Alexa elicits, validates, or confirms slot values, she will need to ask the user for missing or different information or to confirm what she hears. Prompts, declared in the prompts property, are the follow-up questions, cues Alexa will use to obtain missing or incorrect data.

We’ll look at validation and confirmation a little later in this chapter. First, let’s declare dialog rules to make sure that the user provides everything needed to schedule a trip and the prompts Alexa will speak to collect any missing information.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset