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 one 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 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 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:

  • Create a new intent in LUIS.
  • Create a new class in Teneo.
  • Add a second trigger to our flow and add a Class Match Requirement to the trigger.
  • Make the trigger context dependent using the Match Requirements for Context, Follow up of Flow.
  • Save and test the flow.

The final result will look like this:

Image of final flow

Let's get started!

Create a new LUIS intent

We will start off by creating a LUIS intent inside our application which will be used by our Teneo solution.

You will need to do the following:

  1. While inside your LUIS application, create a new intent by pressing 'create'.
  2. Give your intent the name: ANOTHER_ONE_PLEASE.
  3. Add the following examples:
    • Another one
    • Can I order another one
    • One more
    • Can I make one more order
    • Another order
    • 1 more
  4. Press the 'Train' button located at the top right corner. This will train the intent and score the examples.
  5. Once the training is done press 'Publish' at the top right corner. This so Teneo can retrieve it.

Create the same intent in Teneo

Now its time to create the same intent we did for LUIS in the previous step but inside Teneo.

  1. We'll start of by selecting the 'Class Manager' icon in the 'Solution' group in the Ribbon. This will open a new window for the 'Class Manager'.
  2. Select the 'Add Class' button located in the 'Classes' group in the Ribbon.
  3. Give your class the same name as your LUIS intent: ANOTHER_ONE_PLEASE.
  4. Next, right-click the empty area in the learning example area and paste the inputs (alternatively, you can add them one by one)..
    Another one
    Can I order another one
    One more
    Can I make one more order
    Another order
    1 more
  5. Finally press the 'Save' button and close the 'Class Manager' page.

Add a second trigger to the flow

Go ahead and add a second trigger to handle the follow up questions:

  1. Open the flow 'User wants to order a coffee' in edit mode
  2. Click 'Add Trigger' in the ribbon
  3. Give the trigger the name Another one please
  4. Scroll down to 'Match Requirements' and press add.
  5. Select 'Class' and paste in the Class name ANOTHER_ONE_PLEASE.

Make the trigger context dependent

We are going to restrict the context of the second trigger 'Another one please' so that 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. Select the second trigger, this will open the 'Trigger configuration' panel to the right.
  2. Scroll down to the 'Match Requirements" section and 'Add' a new 'Context'.
  3. From the dropdown, choose the global context 'Follow up of Flow'.
  4. 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 the Try Out window.

First try a working case:

User: I want to order one 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.

Now restart your Try Out 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: I'd like one more.
Bot: I'm sorry but I didn't get that.

What's next?

Congratulations, you are finally done with the Getting Started with LUIS^Teneo section. Let's continue on to Build Your Bot that has more in-dept info on how to build your bot.

Was this page helpful?