{{announcement.body}}
{{announcement.title}}

Here Is How You Make Your Chatbot Understand Follow-Ups in Teneo

DZone 's Guide to

Here Is How You Make Your Chatbot Understand Follow-Ups in Teneo

Implementing the example dialog by adding a context-dependent trigger to the ‘User wants the bot to suggest a coffee’ flow.

· AI Zone ·
Free Resource

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:

user requesting coffee from bot

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
  3. Add the following condition:
  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 that 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 exists 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 a 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 a follow-up, but this time without any preceding question:

User: Another one
Bot: I’m sorry but I didn’t get that.


Further Reading

A Beginner's Guide to Creating an Interactive Chatbot Flow in Teneo

Changing Information for Your Chatbot Flows in Teneo

Topics:
conversational ai ,conversational ai chatbot ,chatbot development ,artifcial intelligence ,ai ,machine learning & ai ,chatbots ,tutorial

Published at DZone with permission of Gareth Walters . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}