In this How-To, we will explore a scenario in a Travel Planning Assistant, where traits can be used to steer the conversation flow in a more natural and predictable direction. For details on what Traits are and how they are implemented in the Kore.ai XO Platform, please refer here.
Problem Statement
Consider the cases where the user is trying to report an issue or ask a question pertaining to “Make a Booking”. The VA might trigger the “Make a Booking” intent as opposed to “Issue Resolution”. The problem that may arise in this scenario is that the user is presented with a response that is not relevant to their utterance.
In this document, we will show how Traits can be used to identify such situations and take appropriate action.
Prerequisites
To go through these configurations, you need to know at least the basics of building a Virtual Assistant. This is because your assistant needs to have been already built when you begin working on your forms.
In addition, your VA requires the following configurations:
- Book a Flight Dialog Task – This task allows the user to make a flight booking via the assistant.
- Issue Resolution Dialog Task – This task assists in any issues faced by the user. It displays a regret message and transfers the conversation to a Live Agent.
- Knowledge Graph Booking FAQ – A Booking node with an FAQ for How do I make a Booking?
Implementation
Intent Detection using Traits
We will be using Trait to steer the conversation to “Issue Resolution” when the word “issue” is present in the User Utterance.
Steps:
- Select Build tab from the top menu
- From Natural Language -> Training select the Traits tab.
- Click Add New Trait. We will be using a trait to identify the existence of the word ‘issue’ in the user utterance.
- Add a Trait Type as Problem Statement, and Traits as issue. A given Trait Type can have multiple Traits grouped together logically.
- Optionally you can add utterances for Issues as ‘problem’, ‘unable to’, and ‘not working’. These are the alternate words that users might use to indicate an issue.
- Save & Add Rule
- We will be defining the intent that needs to be triggered in the presence of this Issue trait.
- Select Intent – Issue Resolution to be triggered in the presence of this trait.
- Add the Trait Rules – issue as the trait that should trigger the above selected intent.
- Save the Trait Mapping
- Train the Traits.
- Open the Issue Resolution Intent to see the Trait Rules under the NLP properties panel updated with the issue trait.
- Talk to the Bot and see the conversation flow. As you can see in the illustration below, rather than detect the Make a Booking intent, the VA uses the Issue Resolution task to transfer the conversation to an agent. This is despite the fact that the user utterance contains the full Make a Booking sentence. The VA picks up on the presence of an utterance which we have set up under the Issue trait – the word problem – and thus triggers the intent that we selected as the rule, rather than the other one.
Knowledge Intent using Traits
Here we will see how to drive the query from the user to the appropriate FAQ instead of the dialog task.
Steps
- From Natural Language > Training open the Traits dialog.
- Click Add New Trait. We will be using a trait to identify the existence of questions in the user utterance.
- Add a Trait Type as Inquiry, and Traits as ask. A given Trait Type can have multiple Traits grouped together logically.
- Optionally you can add utterances for Issues as ‘wondering’, and ‘want to know’. These are the alternate words that the user might use to indicate an inquiry.
- Save & Exit the Trait.
- Train the Trait.
- Associate the Trait to the FAQ
- Talk to the bot and say I want to make a booking. You will see that the assistant is still detecting the Make a Booking intent.
- To understand the reason behind this:
- To ensure that the intent is not selected, we will add a Negative Pattern to the Book Flight intent.
- Go to Build > Conversation Skills > Dialog Tasks and select the Book Flight task.
- Select the primary intent node and go to its NLP Properties.
- Under Patterns click Add Pattern.
- Select the Negative Patterns tab. Add the words know, ask, any any other question identifiers.This will ensure that the ‘Book Flight’ intent is not identified when either of the negative patterns is present in the user utterance.
Check the Utterance Training and ensure that the Book Flight intent is rejected because of the negative pattern. Finally, Talk to the Bot and test the changes.