AI - Intent Detection

Conversational interfaces, or chatbots, have two primary ways of accepting input from users, menu driven (button bots) and natural language (free text). Flow XO provides a variety of tools for both interaction styles. 

For natural language processing (NLP), Flow XO provides a powerful AI driven "Intent Detection" technology that allows you to specify what intents your chatbot is designed to handle, and what action should be taken when a user expresses each intent. When the user types a message that indicates one of your pre-defined intents, they will be served an appropriate response from the bot.

An intent in Flow XO consists of a name and a set of example phrases that should correspond to that intent. It is not necessary to figure out in advance every possible way a user may ask for something, since our intent detection mechanism uses AI to compare incoming messages and intents via the underlying meaning of the intent, rather than the text similarity. .

Because of this flexibility, usually only a few samples are required for each intent to allow it to be matched to a very wide array of possible variations and phrasings of a question or command (even in languages other than what the intent was specified in!)

How to use intent detection in your bots

There are two main ways that intent detection can be used in your bots and workflows. The first is as a dispatching mechanism, to make sure that incoming requests are routed to the correct workflow based on the needs of the user. 

The second is as a flexible, multilingual way to interpret user input (or other text, such as Open AI outputs) into a structured form from within your workflows in a way that can be easily used by your filters, messages, and other flow parameters.

1. Automatic Intent Detection

The simplest way to use Intent Detection in Flow XO is to automatically apply intent detection on incoming messages to determine which actions to activate for a given question or command from a user.

How it works:

1. A message is received from a user
2. The message is analyzed and an intent is detected
3. The 'action' associated with the intent is executed

To take a concrete example:

1. A user types the message "I need to book a demonstration"
2. Your pre-defined intent "schedule demo" is detected
3. The schedule demo intent has a 'Trigger Flow' action that points to the 'Schedule Demo' flow. The 'Schedule Demo' flow is automatically triggered.

2. Manual Intent Detection

The other approach is to detect intent at a certain point in a workflow, using the 'Detect Intent' task from our AI tools. In that case, it would look this this:

1. In your flow, using an 'Ask a Question' step, you ask your user if they are ready to complete a purchase using a free text question.
2. Your user types 'I need to know more about the money back guarantee'
3. Using a 'Detect Intent' action, you process the users input, and the 'guarantees and refunds' intent is detected. 
4. Using a talk with a filter configured to match 'guarantees and refunds', a sub-flow is triggered that explains the guarantee and refund policies.

Creating, Managing and Testing Intents

In Flow XO you can create groups of intents called "Intent Detectors". An intent detector is simply a group of intents that are intended to be used together to process user input. Often, you will only need one default intent detector that contains all of the intents your bot needs in one place. However, there are times where you might want to keep some intents separate from others, such as if you run an agency and you want one bot to use one set of intents, and another bot to use another set of intents. Or, you may have a flow that needs to detect a very specific set of intents for a particular task.

To get started, click on the 'Intents' menu item of the main navigation panel:

Now you can click 'New Intent Detector' to create a new intent. The first intent you create will be considered the 'Default' intent, and will be used to analyze all incoming messages from your users (that aren't already part of an ongoing interaction) and assign the appropriate intent and take the prescribed action.

The configuration settings for intent detectors (name, description) are just for your reference. They won't impact how the intent detector functions.

Next, you should add some intents.

There are two ways you can "train" your intent detector. The simplest method is simply to type in a phrase or a question that represents something you expect your users to say or ask in the "Test Phrase" box, and then click 'Detect Intent'. Don't worry about the 'Sensitivity Override' for now, just leave it as 'None'

Of course, since you haven't added any intents yet, the result will come back without a match:

Now, however, if you click the 'Assigned Intent' dropdown, you can choose 'Create New intent'

Enter the name of the intent this question should represent, and click the green checkmark to create your new intent:

The new intent will be created with the sample "Can I talk to an agent?"

You can test this by trying out a new test phrase, such as "need an agent"

You will see that the intent detector matched the "agent chat" intent you just created, because "need an agent" has a very similar meaning to "can I talk to an agent?"

If you want you can add the phrase "need an agent" as a sample to your "agent chat" intent right from this screen by click the green checkmark. However, it isn't usually necessary to load up your intents with a ton of similar samples unless you are getting conflicts with another intent during your testing.

Let's flesh out our intent a little though - let's try 'transfer me to an operator'

This one didn't work, it wasn't close enough to the existing samples. Since we know we want a live chat in this case, from the 'Assigned Intent' dropdown, choose 'agent chat' and click the green checkmark. Now, 'transfer me to an operator' is one of the samples for 'agent chat'

Try typing 'connect me to someone' and clicking 'Detect Intent'

It worked!

Using this pattern of typing test phrases and creating or assigning intents, you can quickly and easily train your intent detector to recognize your users inputs.

This method is great if you don't already know what phrases you want to use. If you have a pretty good idea of your intents and their associated samples, it can be quicker and easier to create your intents and a bunch of samples all at once. To do that, instead of typing in the 'Test phrase' input, you can click 'New intent' in the top right corner of the Intent Detector page.

From here, you can give your new intent a name, and add as many samples as you want, one on each line:

Understanding Intent Sensitivity

You can define a "sensitivity" for each of your intents. When our AI attempts to match an input text with one of your intent samples, we calculate a score based on how confident the model is that the sample phrases match. A higher score means that the users input is very close to one of the samples, and a lower score means it may only be moderately related.  The 'Sensitivity' setting determines how high of a score is required for an intent to be considered a a match. 

Here are the different sensitivities you can use:

Always Match - the input phrase will ALWAYS match one of your intents (i.e. the intent detector will NEVER return an unknown response). 
Loose - the intent detector will match phrases that are loosely similar to your samples
Normal - the intent detector will match phrases that are similar in meaning, but may not mean exactly the same thing
Strict - the intent detector will try to only match phrases that have a meaning very close to the samples
Exact - the intent detector will ONLY match phrases whose sample matches word for word with the input text

Taking Action - how to react to detected intents

Flow XO provides a variety of ways to take action based on the detected intent of an input phrase. There are two main categories of actions:

  • Manual - you determine when intent detection occurs, and what to do with the result, inside your flow specifications
  • Automatic - intent detection happens automatically, for every incoming message that isn't a response to an ongoing interaction (like the user answering a question inside a flow)

Automatic Intent Detection

By default, when you create your first intent detector, it will configure itself to be in automatic mode, and enabled for your entire account. You can see this because it will say 'Default' in parentheses after the name:

If you want to use a different intent detector as the default, or want to disable automatic detection, you can do that from the action menu associated with your intent detector

To disable automatic intent detection:

Bot/Channel Specific Intent Detectors

While your account can have a default intent detector that will apply to every bot, you can override this in your bot settings for any particular bot by setting the intent detector setting in your bot configuration. You can also disable intent detection for a specific bot.

Intent Actions

When automatic intent detection detects an event, you will usually want to take some kind of action. You configure the action associated with an intent in the edit screen for each intent.

There are currently 5 different kinds of actions that Flow XO can take when a specific intent is detected. They are:

  1. Event - trigger an event that you can respond to using a "New Intent" trigger in one of your flows
  2. Flow - start a specific flow. You can either specify the exact flow from a dropdown, or you can configure a "trigger phrase" that can dynamically trigger a flow based on certain keywords.
  3. Message - send a pre-configured message when an intent is detected. This action is useful if you want to use an intent detector as an AI powered FAQ, where the questions are Samples and the Answers are sent via the 'Message' action
  4. Live Chat - start a live chat session with the users
  5. Menu - send a menu to the user. Choose from your pre-configured menus to have sent to the user when an intent is detected

These actions all behave exactly as you would expect, but the "Event" action requires some additional explanation. To make use of this action type, you will need to create a flow with an "New Intent" type of trigger. To do that, create a new blank flow, and choose "New Intent" from the triggers:

Then you must choose an intent detector, and optionally an intent

Any time an intent from the selected intent detector is triggered using the "Event" action, Flow XO will look for any flows with matching New Intent trigger. If you specify a specific intent, then the flow will only be triggered when that intent is detected. If you do NOT specify an intent, then the flow will execute any time ANY intent from the selected Intent Detector is detected.

Manual Intent Detection

If you don't want to use automatic intent detection, or you want to use intent detection as a component of a workflow, you can use the 'Detect Intent' task from our AI tools:

When you want to use this task, you can configure the intent detector you want to use, the input text, and an optional sensitivity override

Intent Detector  - the intent detector you want to use to detect the intent in the provided input text

Input Text - the text you want to use to detect an intent. Usually this will be user input, but it could also be any text, including output text from OpenAI. This might be useful if you want to detect certain kinds of answers from Open AI that require a custom response. For example, if you have a very specific way you want your users to contact your support, you could use intent detection to determine when Open AI is directing your users to your support team, and take an alternative action when the 'support' intent was detected in ChatGPT's response to a user question.

Sensitivity Override - each intent, when it is defined, can be configured with a sensitivity (see above). If you want to specify a different sensitivity when performing intent detection, you can specify it here. This is normally not required.

Reviewing Intent Detection History

Once your bot is running using intent detection, you will want to periodically evaluate how well your intent detection strategy is converting your users inputs into actionable intents. To do that, you can use the Intent History feature. On the 'Intent Detectors' page, click on the 'History' button in the top right of the screen:

From here, you can review each intent detection Flow XO has processed, including the input text, the intent that was detected, and how long the detection process took under the hood:

This is a very helpful tool you can use to decide if your intents need more samples, or if you need some new intents, to properly serve your users. 

That's it... Intent detection is an extremely powerful feature that can dramatically simplify and improve your conversational workflows and chatbots, making them more flexible and lifelike with less effort. Please let us know if you have any questions or feedback regarding this feature.

Happy flowing!

Still need help? Contact Us Contact Us