How you Make your Chatbot Understand Follow-Ups in Teneo

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 the bot to suggest a coffee’ flow that we created and updated earlier.

What we will do is the following:

  • Add a new syntax trigger to our flow
  • Make the trigger context-dependent using the global context – Follow up of Flow

The final result will look like this:

Let’s get started!

Add a syntax trigger to the flow

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:

  1. Open the flow ‘User wants the bot to suggest a coffee’ in edit mode
  2. Click ‘Add syntax trigger’ in the ribbon
  4. Add positive examples to the syntax trigger:one more what else would you recommend can you suggest another give another recommendation another one
  5. Give the trigger the name Another one please

Make the trigger context dependent

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.

  1. With the syntax trigger still selected, go to below the Examples, in the Context Restrictions area, click the green plus button ‘Add’.
  2. From the dropdown, choose the global context ‘Follow up of Flow’.
  3. Make sure the value chosen is sameFlow (it will be chosen by default).

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.

Save and test your flow

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.

Teneo Developers

Try Before You Buy.
Build. Deploy. Analyze.

Sign up to get your own developer sandbox of Teneo containing all the tools needed to build and manage advanced conversational solutions.

Get Started For Free