Creating a dialog with slot filling

 

Introduction:

It is useful to work with slot filling so that your chatbot automatically asks for missing information from the chat user. But how do you actually create such a dialog? Read below how to create a dialog with slot filling in your chatbot.

 


Creating a dialog with slot filling

Let's build a basic dialog with slot filling. We'll use an 'order pizza' flow as an example. The structure of a slot filling dialog is as follows:

  • Step 1: User turn for catching the general intent of the user
  • Step 2: Bot question requesting entity value
  • Step 3: User turn for giving an entity value
  • Step 4: Train utterances to recognise valid entity values
  • Step 5: Bot reply for confirming the given entity value
  • Step 6: Bot reply for when the user’s given entity value doesn’t match

1.png


Step 1: Create intent

  • Step 1: Create a user turn with an intent 'order.pizza' that lets your user order a pizza. 
  • Step 2: Don't select an entity.
  • Step 3: Enter a primary utterances, and about 10 utterances to train your intent.
  • Step 4: Save your intent

2.png


Step 2: Ask for entity value

  • Step 1: Add a bot turn to your intent.
  • Step 2: In the turn editor, select Question to create a question.

3.png

4.png

  • Step 3: In the Question text field, add a question that asks for the pizza topping.
  • Step 4: In the Entity field, select the name of the pizza.topping entity that you created in the previous step. This is the slot that your bot wants to fill.
  • Step 5: Save your bot turn.

Step 3: Capture user answer

 

Add a user turn for catching the user's pizza topping

  • Add a user turn to your bot question.
    5.png

  • In the Enter intent field, create an intent 'add.topping' to let the user choose their pizza topping.
  • In the Add entity field, select the name of the pizza.topping entity that you created in the last turn. We need this so that your chatbot can check whether your user's answer matches one of the values for pizza.topping. 
    6.png
  • In Utterances, add 5 to 10 utterances that contain the values of your pizza.topping entity (including some synonyms).
    7.png

  • Save your intent

Step 4: Mark utterance with entities

Train your utterances to recognise entity values.

Before we can move on to the next step, there's one more thing you need to do: to let your chatbot know what are the entity values in your users' utterances. 

  • Open your add.topping intent once more.
  • For each of the user utterances, select the entity value in that utterance, so that it is marked blue. In our example, we're marking the toppings.
  • From the list, select the entity that this value belongs to. In our case, all toppings belong to the entity pizza.topping.
    8.png
  • Save your intent.
  • You should now see your bot's pizza topping question, followed by a user turn and a no.response turn:
    9.png

 


Step 5: Confirm user's choice

Create a bot reply to confirm the user's choice

When your user enters an entity value that your chatbot recognises as one of the toppings in your pizza.topping entity, you want to confirm their choice. 

  • Add a bot reply to your add.topping intent.
  • Add a reply text that confirms your user's choice.
    To include the recognised entity value in your bot's response, add  the entity name between double curly brackets: "A pizza with {{pizza.topping}}, great choice!"
  • In the live chatbot, this code will be replaced by the actual entity value that the chatbot has recognised.
  • Save the bot reply. 

10.png

 


Step 6: Create no.response

Create a bot reply for when the entity value isn't matched

When your user asks for a topping that's not part of the pizza.topping entity (for example, we didn't add chicken to the list), you want to let them know, and offer them another suggestion. 

  • Add a bot reply to your no.response turn.
  • Add a reply text that lets your user know that their choice is not available, and ask them to choose something that is. 

12.png

13.png