Using nlMeta¶
Sometimes, one wants to control the flow of the AI Agent by taking an alternate path to improve the user’s experience.
DialogGPT-based apps support handling interruptions across linked apps using the nlMeta object. It allows you to pass information directly to the AI Agent, which prioritizes and executes the specified intent before processing any other input.
Consider the following scenarios:
-
The DialogGPT-based app has identified an intent based on the user's utterance. However, based on additional information gathered from the backend systems, the webpage where the SDK is hosted, or any other external information, a different task might be more suitable.
-
Consider a flight booking assistant that greets the user with the best ongoing deals as part of the Welcome message. Based on the user selection, the ‘book flight’ task can be programmatically invoked by prepopulating the travel details, like source city, destination city, travel, etc., from the deal information presented to the user.
Kore.ai provides a way to programmatically pass information to the assistant using nlMeta data. This can be used in the BotKit SDK, Widget SDK, and Web SDK to pass information like intent to be triggered, entity values, and other task settings, as needed.
nlMeta¶
The nlMeta is an object that can be used to pass information on to the AI Agent. The AI Agent would use this information to execute the intent specified therein before attempting to decode any other information.
Sample¶
The following is a sample of how the nlMeta object needs to be populated:
"nlMeta" :{
"intent": "Login",
"childBotName":"NL Meta_Test_1",
"entities":{
"Password":456
},
"hr": {
"h": 4,
"r": 1,
"nn":false
}
}
Parameters¶
The following are the parameters that can be used in this object:
| Parameters | Description | ||||||
| nlMeta | An object for natural language information for the AI Agent | ||||||
| intent | Intent identified via 3rd party, which needs to be triggered by the AI Agent | ||||||
| entities | Object with entity-value pairs as needed by the intent to be triggered | ||||||
| isRefresh |
|
||||||
| interruptionOptions | This is to indicate the interruption behavior in case any task is in progress when the AI Agent receives this nlMeta information. Values can be:
|
In case, the requested task is not found the AI Agent would respond with a standard response “Dialog task required for conversation not available”.
Usage¶
As mentioned, nlMeta can be populated and sent to the assistant via BotKit SDK, and web/widget SDK. The following illustrates how it can be accomplished:
BotKit SDK – as part of metaInfo object:
data.metaInfo = {
'nlMeta': {
'intent': 'Authenticate User',
'isRefresh': true,
'entities': {
"Name": "John"
},
'interruptionOptions': 'discardAll'
}
}
Web SDK – the nlMeta information can be sent as a parameter using the sendMessage function. You can find this function in the chatWindow.js file. Add a condition when the nlMeta data needs to consumed as follows:
if(_this.text() == “Existing”){
me.sendMessage(_this, attachmentinfo, {'nlMeta': {
'intent': 'Authenticate User'}});
}
else{
me.sendMessage(_this, attachmentinfo);
}
Widget SDK – the nlMeta information can be sent as part of the payload for various templates like button, menu, list, etc., see here for details
Frequently Asked Questions¶
Does the platform honor interruption settings when a new intent is received from BotKit using NLMeta?¶
Yes, the platform honors all interruption settings when it receives a new intent from BotKit using NLMeta.
Does BotKit provide details about the current node and dialog name?¶
Yes, BotKit has full access to the context object, which includes details about the current task and entities.
Can I set an entity value directly from BotKit using NLMeta?¶
Yes, you can set the entity value of an ongoing dialog task directly from BotKit using NLMeta.
Can I send an FAQ as part of NLMeta?¶
Yes, you can trigger an FAQ from NLMeta. To do this, include an additional key called "intentType":"KG" in NLMeta. By default, NLMeta triggers dialog tasks. Use this key to trigger FAQs from the Knowledge Graph.
For example: