Overview
Conversational (or chat) skills allow users to have conversations with Andi® via the Andi® window. These conversations are the result of natural language events that based on the conditions in skill code, determine the response provided. This article provides background on natural language concepts and settings for use when writing conversational skills.
At this time, Get Help and Show Me are the available conversational skill types.
In this Article
Natural Language Concepts
When a user asks a question in the Andi® window, such as "How do I add fees?", the user has created an utterance. An utterance is when a user inputs a question or statement to Andi (a string of text), creating a conversation or InboundNaturalLanguage event.
Utterances are mapped or assigned to an intent. An Intent is the goal or overall purpose of various, related utterances. In the PrecisionLender application for example, "How do I add fees?" and "How do I add a deposit?" contain "How" utterances that indicate the user needs help with how to do something. In many cases, PrecisionLender has support articles that help answer those questions. These utterances are assigned to an intent called getHelpContent that return those articles in order to fulfill the purpose of helping the client understand how to do something.
PrecisionLender Intents
PrecisionLender has created a set of intents that it maintains using Language Understanding (LUIS).
- GetHelpContent - "how can I" or "help" utterances
- GetDefinition - "define", "what does {defined term} mean", or "what is"
- Solver - "show me a structure {defined condition}", "solve", "suggest a structure", "reduce {defined condition}", "increase {defined condition}"
However, you may find that those intents and/or utterances don't exactly meet the needs of the goal of your skill. For instance, there may be terms that aren't defined as part of our GetDefinition intent because they're unique to your organization. There could be solver utterances that aren't included because they're not for commonly asked for scenarios. You have the ability to create additional intents that may be more relevant for your conversational skill(s) by defining Natural Language Processing (NLP) settings in the skillmanifest.
What are NLP Settings?
nlpSettings is a JSON object with the following schema in the skillmanifest, and is stored as part of the skill metadata:
"nlpSettings": { "regexMatches": [{ "regexString": string, "naturalLanuageUnderstandingResult":{ "intent": string, "intentScore": number, "nluIntentSource": string } }], "directMatches": [{
"directMatchString": string,
"naturalLanuageUnderstandingResult":{
"intent": string,
"intentScore": number,
"nluIntentSource": string
}
}] }
regexMatches is where you can define a regular expression array that contains the information needed to identify if an utterance is relevant for a given intent.
-
regexString is where you define the string(s) of text that your skill will compare the utterance to, to see if it is relevant for the intent. This will allow for recognition of more complex utterance patterns. If you'd like multiple strings to be recognized for the same intent use '|'. For example:
"regexString": "deposits|money market|dda|cd",
- regexFlags is an optional parameter where you can add flags that impact the regexString search results. By default, g and i flags will be used if regexFlags are not defined in nlpSettings. For more information on flags, see Regular Expressions - Patterns and Flags.
directMatches is where you can define an array that contains the information needed to identify if an utterance is relevant for a given intent.
-
directMatchString is where you define the string(s) of text that your skill will compare the utterance to, to see if it is relevant for the intent. The utterance string must be an exact match to the string entered here, including case sensitivity. Multiple strings are not supported for directMatch.
"directMatchString": "deposits",
Within both arrays, the naturalLanguageUnderstandingResult is where the intent will be defined in order for the purpose of the utterance to be understood.
-
intent - entered as a string, is the name of the intent.
-
intentScore - entered as a number, assigns a confidence value to the intent. The higher the assigned score, the higher the degree of certainty that an utterance is relevant to the intent, and as a result, that the intent is a topScoringIntent (winning intent) when compared to other language intents. This impacts whether or not a correct response is returned to the user.
-
Intent scores for PrecisonLender's LUIS intents will always range from 0-1, with 0 being a failed match (lowest confidence) and 1 being a definite match (highest confidence) in accordance with LUIS prediction scores.
-
NLP Settings permit you to assign scores higher than the standard 0-1 range for regexMatches and directMatches. As a best practice to prevent your skill's intent from losing to a LUIS intent, your intents should be assigned an intentScore greater than 1. While there is no limit for how high to score your intent, at extremely high scores, the scoring becomes less accurate. Your intentScore assignments should be limited to less than 100.
-
-
nluIntentSource - entered as a string, is the source of the intent being created. Ideally, this would be your client name, the author name, or a combination of the two, persisting the use of that intent source as you create other intents.
For Example
"nlpSettings": { "regexMatches": [{ "regexString": "when is the next loan committee", "naturalLanuageUnderstandingResult":{ "intent": "loan committee", "intentScore": 1.1, "nluIntentSource": "Andi-Bank-Intents" } }], "directMatches": [] }
See the 'GetHelp' Skill Template for an additional example of nlpSettings used in skill code.
Rules for Intents
It is important to be aware and mindful of the intents being created in your organization because this will impact whether or not the desired response is returned to the user. When writing multiple skills with custom intents, here are some rules to keep in mind:
- For intents with different names and different scores, the intent with the highest score will win.
- For intents with different names but the same score, if the score range is between 0-1 and matches with a PrecisionLender intent, then the PrecisionLender intent will win. Otherwise, the most recently updated skill will win.
- If there are multiple intents with the same name, then all of them will run because they are treated as the same winning intent
To help minimize the potential risk of intents being in conflict with one another, it may be beneficial to house all intents of a given conversational skill type in one skill. For example, if you desire to create several skills that solve for how to do something, rather than create 3 separate solver skills, you could create 1 solver skill, with the applicable intents in the manifest, and the three separate conditions defined in the run.ts.
Ultimately, it'll be up to you and your team of skill writers to be in communication with each other, making sure it is understood the impact multiple conversational skills may have as they are deployed and enabled for your organization.