This post is part of a series of tutorials on conversational forms:
- Part 1: Getting Started
- Part 2: Handling Interruptions and Side Questions
- Part 3: Handling Contextual Questions and Adding NLU
This series of tutorials explains how to implement slot filling or conversational forms in Botfront without code. Botfront forms are based on the Rasa's
FormPolicyand offer the same flexibility and resilience.
In our previous post, we have seen how to create a simple conversational form with Botfront.
In this tutorial we'll start exploring scenarios accomodating users not following the happy path. In particular we'll see how to create natural and resilient flows by combining forms with branches and links.
We will start by allowing interruptions: when the user asks to stop (i.e. with the stop intent), we'll ask a confirmation. If they confirm, we'll acknowledge and stop the form, otherwise we'll resume it and repeat the last question.
To do this we need to adjust our stories and our slots configuration.
1. Let's split our story in order to have all form related directives in a single story:
At this point, we didn't change the functionality. Having a separate story handling the whole form process will allow to handle deviations easier.
Don't forget to link the Start form story to the Happy path one.
2. Let's create 2 branches Happy path and Interruptions and move the completion path to the Happy path branch.
3. We start the Interruptions branch with a stopping intent. The first thing we need to do is deactivating the form. Deactivating is more crucial when side questions are enabled (next post), but it's a good practice to do it sytematically. Then we ask for a confirmation
4. In the confirmation branch (the user says yes) we just need to acknowledge since the form is already deactivated. The user can start asking other questions.
5. In the resume branch, we acknoledge and link back to the story (see at the very end of the video). The form will be reactivated and the last question will be repeated.
Finally, we need need to let our form know that it should not try to fill the slot if the stop intent is recognized.
If you don't do this, at the
first_name step the assistant would take stop as your first name and at the
work_email step it would just thwrow that the email is invalid. Since we already restricted the intent to inform at the
company_size step, we don't have to do anything else.
Now we can chat with our assistant and play with the interruption flow. Don't forget to train first.
We handled interruption in our flow, but you could use the exact same mechanism to answer generic side questions that a user might ask while answering yours. In a pizza ordering bot, a user could check the delivery time while you're asking which type of cheese they want.
The next step is offering clarifications users may need to answer a particular question the form is asking: Part 3: Handling Contextual Questions and Adding NLU