Multi-Intent Recognition and Handling

Multi-Intent Recognition and Handling

What is this article about?

The life of a bot could be so easy – if users would just follow the happy path and do what the bot expects them to do!

Life is not always easy, even for a bot. Humans can get pretty creative in expressing themselves and might also throw several requests at once at your bot. Unfortunately, most bots are not prepared to handle this multi-intent situation – just test it yourself on bots you find deployed in the world. Here we present a nice and easy-to-implement design to handle multi-intent situations seamlessly in the Teneo Platform.

Let’s dive into the details

First, let’s analyze the task. If a user sends an input which contains two different requests then our bot needs to identify those two requests and afterwards handle them correctly. I suggest we start calling these two different tasks for our bot Multi-Intent Recognition and Multi-Intent Handling. Let’s use the following user input as starting point related to a solution within the telecommunication area:

I would like to renew my contract and can you please also tell me the current download speed of my internet connection?

Multi-Intent Recognition

Both “I would like to renew my contract” and “tell me the download speed of my internet connection” represent an intent in our solution. Both individually could trigger a flow inside our solution to handle each intent. However here our solution needs to identify that the user has been talking about two separate but relevant intents. In order to do so, we create a list as global variable called listIntents which we will use to store the intents we have identified – let’s call this our Intent Stack .

How do we fill our Intent Stack ?

This can be done in different ways. Here I recommend setting up a Global Pre-Listener with the following Condition:
recognizer

intents

The INTENTS.LIST is a Language Object created inside the solution and looks like this:

intents_list

This list contains other Language Objects which reference the intents we want to consider for Multi-Intent Handling.

Here is a look at the TELCO_DOWNLOAD_SPEED.INTENT:

intent

The condition makes reference to both a linguistic rule based on Language Objects and an annotation coming from the machine learned classifier, using Teneo’s unique Hybrid Approach for flexible and precise Intent Recognition. However, you may customize this as you wish.

Please note the script you see under Value within the Language Object’s LO Variable intentName . When activated, this little script adds “DownloadSpeed” to our intent list listIntents , which will then look like this in our Advanced Tryout when we talk about Download Speed:

global_variable

If we talk about several intents, such as a renewal and the download speed, then our intent list will look like this:

global_variable2

Now that we have identified the intents, we need to decide how our bot should handle this situation in the best way.

Multi-Intent Handling

For this section we have several options for implementation, very much depending on the User Experience we want to achieve.

I’ll suggest here one approach I like – let’s see if you agree!

The idea is the following:

  • We will first handle the most relevant use case completely
  • We will then offer to handle the second case

Which is the most relevant use case here? We will decide this via Trigger Ordering and process the flow with the highest trigger order of our relevant use cases. You could also specify other criteria to make this decision.

trigger_ordering

Our initial user input “I would like to renew my contract and can you please also tell me the current download speed of my internet connection?” should trigger the Renew Contract flow first, handle the flow accordingly, and then help the user with the second intent around Download Speed. Teneo offers a very nice feature for this kind of situations – proactive Prompt Triggers.

We use a programmatic expression for the Prompt Trigger, checking if our intent list contains “DownloadSpeed” as pending topic. We then activate this proactively in our conversation after having handled the first intent – recall that Prompt Triggers only fire if the flow stack is empty, so this will happen automatically once handling the first intent is complete.

proactive

Also note that we are cleaning the intent list as we handle intents. Here is an example from the Renewal flow:
renewal_flow

This is necessary as we want our Intent Stack to only contain pending, unhandled intents.

Now our solution is able to elegantly handle a multi-intent conversation.

Final Conversation

MultiIntents

Conclusion on Multiple Intents

Being able to identify multiple intents in a single user input and handle them in a flexible, intelligent manner is a nice way to make your bot more intelligent and improve the user experience in your project. Teneo provides several features to handle this situation, and makes its implementation an easy task, as we have seen today in this article.

If you have any questions, feel free to ask here in the comments.


A Teneo Tuesday article. #TeneoTuesday

5 Likes