Multi-Intent Recognition and Handling - Revisited

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 implementation 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

MultiIntentCondition

The listed items contain references to Language Objects which hold the recognition criteria for the intents we want to consider for Multi-Intent Handling. Probably you want to have only business-related intents on this list and avoid having follow ups from small talk areas. In the end this depends here on your project’s requirements and it is fully customizable in the shown setup. The combination of the Optional Match and the And operators ensures that all intents will be identified correctly and added to our intent list. The last two lines of the script in the previous screenshot can be set if we wish to detect multiple intents only when we are not in an active flow (the flow stack is empty).

Let’s take a look at the TELCO_DOWNLOAD_SPEED.INTENT:

download_speed

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. Make sure to use here in your project robust and precise matching criteria, e. g. a certain minimum confidence score or a precise linguistic rule.

Please note the Propagation Script we are using in our Multi Intents Recognizer. When activated, this little script adds the corresponding name of the intent, e. g. DownloadSpeed, to our intent list listIntents, which will then look like this in our Advanced Tryout when we talk about Download Speed:

listIntents1

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

listIntents2

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.

Also note that we are cleaning the intent list as we handle intents. Here is an example from the 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, as we have seen today in this article. I would advise though to really focus on the user experience that makes most sense for your project and implement accordingly. If you detect a small talk and a business-related intent, for example, would it make much sense to have a follow up on the small talk? Probably not. Let’s focus on use cases that are relevant and situations that really happen in your project.

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

REVISITED for Teneo 7: The article has been updated to make use of NLU variables and Propagation Scripts instead of Language Object variables. The latter are deprecated in Teneo 7. If you have implemented this approach by making use of Language Object variables, we recommend to also update your project and make use of NLU variables instead.

5 Likes