How to use slot filling in Dialogflow ES

In this article, I will explain how you can use slot filling to get a list of user inputs in Dialogflow ES.

Before we go further, a couple of things to note:

I usually avoid slot filling in Dialogflow ES

If are quite sure you need to use slot filling, it is best to go with Dialogflow CX

This will be one of the canonical slot filling examples: booking a flight ticket

We need the following pieces of information

  • From
  • To
  • Departure date
  • Return date
  • Flight class
  • Number of passengers

The appeal of slot filling is that the user might provide this information in any order and Dialogflow’s slot filling is smart enough to extract as much useful information as possible from the user utterance and prompt for the rest automatically.

When it works, slot filling makes for an amazing demo! And when it fails, it is equally spectacular.

Create an entity called flightclass

Create an intent called book.a.flight and add the following training phrases

Number of passengers will be a system entity of type sys.number-integer

Download this intent

The departure and return dates are system entities of type sys.date-time

The from and to cities are system entities of type sys.geo-city

The flight class slot is a user defined entity we declared earlier – flightclass

Here is the full list of training phrases

Open the Parameters section and mark ALL the parameters as required

Now click on the “Define prompts..” for flightclass

Add the following prompt for the flightclass

Add the following prompt for the city of departure

Follow the table below for the rest of the prompts

ParameterPrompt text
flightclassWhat class are you flying? (Economy, Business or First)
fromcityWhere are you leaving from?
tocityWhere are you flying to?
departuredateWhat date do you leave?
returndateWhat date do you plan to return?
numpassengersHow many passengers?

This is what your parameter table should look like after you add all the prompts

Now let us test this bot by trying different types of starting sentences

First, we start with just the intent phrase:

Next we start the number of passengers

Next we start by providing from and to locations

Next we start with the departure and return dates

But sometimes the bot can get into a loop. This is the biggest problem with slot filling, and usually the source of jokes online about how chatbots don’t work.

>