Slots

You may have noticed that in the preceding example utterances included some dates and a location. It would be great not to have to list every possible utterance for every location we want to fly to and every possible date combination. For this, we can use slots, which are parameters or variables that can be input by the user.

In the preceding examples, we can add new slots for the following variables:

  • Book a flight for {Date}
  • Check for available flights to {City} on {Date}

If we use those variables, then we can reuse our utterances for whatever the user chooses to input. With any variable, it's often a good idea to limit the number of valid answers or provide extra validation against an expected format. The purpose of this is to limit possible options to valid items, for example, valid cities. To achieve this, we can use slot types. Every slot has a slot type that can be a built-in or a custom type. 

Check the documentation for a current list of built-in slot types. 

With the City and Date slots we have identified, we might pick the AMAZON.City and AMAZON.DATE built-in slot types. Each slot type has a different behavior for how the phrase logically maps to a value. For example, if we used the phrase Book a flight for today, the Date slot would map to 2019-10-31, which is today's date (at the time of writing). This value would be passed on to our application logic in our fulfillment step (covered in the Fulfillment section).

So, if slots define the values that we need from the user, then we need a method to elicit any missing values that the user is going to provide. This is where prompts are helpful.

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

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