Quite often users will ask a follow-up question to an answer your bot just gave, like so:
User: Recommend a coffee
Bot: Now that you're asking, I'd suggest a cappuccino!User: Another one (follow-up)
Bot: Well, you're putting me on the spot here. I'd go for a flat white!
As you can see in the example dialog above, follow-ups are quite often very generic inputs that can have a different meaning depending on the context of the conversation. In the example above, the user wants another recommendation, however in a different context the user might have meant to place another order for example.
There are different ways to manage dialog context in Teneo. For example, you may have already seen that you can share information between flows using global variables.
Here we will explain another way to use context: 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 'User wants bot to suggest a coffee' flow that we created and updated earlier.
What we will do is the following:
The final result will look like this:
Let's get started!
First, we will add a syntax trigger to the flow. Syntax triggers can provide more precision since you have full control over its language condition.
Go ahead and add a syntax trigger:
(%WOULD_YOU_RECOMMEND.PHR &^ (%DIFFERENT.ADJV.SYN/(%WHAT.FW.LEX >> %ELSE.FW.LEX)) )
/
(%DIFFERENT.ADJV.SYN &^ (%ONE.FW.LEX/%SUGGESTION.NN.LEX/%RECOMMENDATION.NN.LEX))
/
(%ONE.FW.LEX >> %MORE.FW.LEX)
Add positive examples to the syntax trigger:
one more
what else would you recommend
can you suggest another
give another recommendation
another one
Another one please
We are going to context restrict the syntax 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.
The global scripted context 'Follow up of Flow' only evaluates to true if the context restricted trigger exist in the same flow as the previously fired flow. For more details, see: Predefined context restrictions.
That's it! Now you can save the flow and give it a try in tryout.
First try a working case:
User: Recommend a coffee!
Bot: Now that you're asking, I'd suggest a cappuccino!User: Another one (follow-up)
Bot: Well, you're putting me on the spot here. I'd go for a flat white!
Now restart your tryout session by clicking the 'restart' button, this will start a clean session without any dialog history. Then try the following input that you would normally use as follow-up, but this time without any preceding question:
User: Another one
Bot: I'm sorry but I didn't get that.
Was this page helpful?