Deal with Follow-ups
Quite often users will ask a follow-up question to an answer your bot just gave, like so:
User: I want to order a coffee
Bot: Ok, what coffee would you like?User: Espresso
Bot: Ok, a espresso will be ready for pickup in 5 minutes.User: I'd like one more (follow-up)
Bot: Ok, what coffee would you like?User: Flat white this time
Bot: Ok, a flat white will be ready for pickup in 5 minutes.
As you can see in the example dialogue above, follow-ups are quite often very generic inputs that can have different meanings depending on the context of the conversation. In the example above, the user wants to order another cup of coffee; however, in a different context, the user might have meant to place the same order again, for example.
There are different ways to manage dialog context in Teneo. We will now explain one way: dealing with inputs that can be considered direct follow-ups to the same flow. We are going to implement the example dialog above by adding a context-dependent trigger to the coffee order flow flow that we created earlier.
What we will do is the following:
- Add a second trigger to our flow.
- Make the trigger context dependent using the Match for Context, Follow up of Flow.
The final result will look like this:
Let's get started!
Add a second trigger to the flow
Go ahead and add a second trigger to handle the follow up questions:
- Open the flow 'User wants to order a coffee'.
- Add another Intent trigger using the Plus icon next to the existing Intent trigger at the top of the flow.
- Give the trigger the name
Another one, please
. - Add Intent examples to the newly created trigger:
Another one
Can I order another one
One more
Can I make one more order
Another order
1 more
- Generate a Match by clicking on the Plus icon under the newly created trigger, followed first by Match and then Generate.
Make the trigger context dependent
We are going to context restrict the second trigger 'Another one please' so it only fires if the same flow has just been active. To achieve this we are going to use a global scripted context which uses a script to evaluate if a context is true.
- In the Match node under the 'Another one' trigger, click on Add match requirement.
- Select Global scripted context.
- From the dropdown, choose the global context 'Follow up of Flow'.
- Select the value sameFlow from the dropdown menu.
- Lastly, save the flow.
Test your flow
That's it! Now you can save the flow and give it a try in the Tryout window.
First try a working case:
User: I want to order a coffee
Bot: Ok, what coffee would you like?User: Espresso
Bot: Ok, a espresso will be ready for pickup in 5 minutes.User: I'd like one more (follow-up)
Bot: Ok, what coffee would you like?User: Flat white this time
Bot: Ok, a flat white will be ready for pickup in 5 minutes.
Then try the following input that you would normally use as follow-up, but this time without any preceding question:
User: I'd like one more.
Bot: I'm sorry but I didn't get that.