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

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
Parameter | Prompt text |
flightclass | What class are you flying? (Economy, Business or First) |
fromcity | Where are you leaving from? |
tocity | Where are you flying to? |
departuredate | What date do you leave? |
returndate | What date do you plan to return? |
numpassengers | How 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.


About this website BotFlo1 was created by Aravind Mohanoor as a website which provided training and tools for non-programmers who were2 building Dialogflow chatbots. This website has now expanded into other topics in Natural Language Processing, including the recent Large Language Models (GPT etc.) with a special focus on helping non-programmers identify and use the right tool for their specific NLP task. For example, when not to use GPT 1 BotFlo was previously called MiningBusinessData. That is why you see that name in many videos 2 And still are building Dialogflow chatbots. Dialogflow ES first evolved into Dialogflow CX, and Dialogflow CX itself evolved to add Generative AI features in mid-2023
You must be logged in to post a comment.