In this How-To, we will explore a scenario in a Banking Bot, where traits can be used to steer the conversation flow in a more natural and predictable direction. For details on what Trait is and how it is implemented in the Kore.ai Bots platform, refer here.
Problem Statement
Consider the cases where the user is trying to report an issue or ask a question pertaining to “Transfer Funds”. The Bot will trigger the “Transfer Amount” intent as opposed to “Issue Resolution” or “FAQ regarding Funds Transfer”
In this document, we will show how Traits can be used to identify such situations and take appropriate action.
Pre-requisites
- Bot building knowledge
- A Banking Bot with the dialogs as mentioned below:
- Transfer Funds – Dialog task prompting the user for Payer and Payee account numbers and the amount to be transferred and transferring the specified amount from the payer account to the payee account.
- Issue Resolution – Dialog task to assist in any issues faced by the user. It would display a regret message and transfer to a Live Agent.
- Knowledge Collection – A node “transfer funds” with an FAQ “How do I transfer funds”
- Transfer Funds – Dialog task prompting the user for Payer and Payee account numbers and the amount to be transferred and transferring the specified amount from the payer account to the payee account.
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.
- Train the Traits.
- Open the Issue Resolution Intent to see the Trait Rules under the NLP properties panel updated with the issue trait.
- Run the Bot and see the changed flow.
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 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 Enquiry, 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 user might use to indicate an enquiry.
- Save & Exit the Trait.
- Train the Traits.
- Associate the Trait to the FAQ
- Run the Bot. You will see that the Bot is still going to the “Transfer Funds” intent.
- To understand the reason behind this:
- To ensure that the intent is not selected, we will add a Negative Pattern to the “Transfer Funds” intent.
- Select Natural Language -> Advanced Settings.
- Enable Negative Patterns. This will enable the addition of Negative Patterns for intents.
- Under Natural Language -> Training select the intent to which negative patterns need to be added, in this case, Transfer Funds.
- Select Negative Patterns tab.
- Add “know” as the negative pattern. This will ensure that the ‘Transfer Funds’ intent is not identified when ‘know‘ is present in the user utterance.
- Check the Utterance Training and see that the Transfer Funds intent is rejected because of the negative pattern.
- Run the Bot and see the change.