Type: NLP Worker
ServisBOT ai is a worker type that does not use any third party services, it’s all handled internally. It is designed to quickly publish bots with low latency responses. Use the Starter Blueprint to get a quick bot setup.
Save this json to a file and create a worker using the cli command sb-cli worker create file.json
{
"Data": {
"NluConfiguration": {
"NluConfidenceThresholdOverride": 0.8,
"Language": "en"
},
"NluType": "ServisBOT"
},
"Organization": "my-org",
"Config": {
"Avatar": "default-bot"
},
"Enabled": true,
"Description": "An amazing ServisBOT Worker",
"Type": "nlp-worker",
"Name": "exampleServisBOT",
"Status": "published",
}
That’s right no configuration required. Once you have created the worker using the CLI, it will return an ID for you. You need to then update/create a bot with this worker.
{
"Name": "exampleBot",
"Workers": [
{
"Type": "nlp-worker",
"Id": "new-id"
}
]
}
Onces the worker is assigned to a bot, simply start adding Intents and publish your bot.
When an intent is hit we store that intent name and the timestamp in the users context, in the DialogStateManagement section under StateHistory. An example of what that might look like is this
{
"state": {
"history": ["cake", "coffee","coffee"]
}
}
The NLP Worker supports execution of conditional botnet actions. An example is:
{
"type": "message",
"condition": "state.history.includes('apples')",
"value": "You already asked me that, the answer is still no, don't you have something better to be doing?"
}
If a conditional errors during evaluation an bot-log exception will be visible.
The conditional can be any valid javascript and the current context is available during evaluation.
The NLP Worker supports detecting custom entities, based on a definition of your chosing.
The entities should be added the EntityStore
key as array of custom entities.
For example:
{
"Data": {
"EntityStore": [
{
"Config": {
"LeftWord": "at",
"RightWord": "pm"
},
"Lang": "en",
"Name": "pmTime",
"Type": "Between"
}
],
"NluConfiguration": {
//some Nlu configuration
},
"NluType": "Lex"
}
}
Custom entities can take the following forms:
The utterance will be matched against some regex string to be detected as an entity of Name
{
"Config": [
"/\\d{4}[ -]?\\d{4}[ -]?\\d{4}[ -]?\\d{4}|\\d{4}[ -]?\\d{6}[ -]?\\d{4}\\d?/g"
],
"Lang": "en",
"Name": "creditcard",
"Type": "Regex"
}
If detected, the entity will be added to the state’s entities array. The sourceText
field will contain what the user typed in the entity’s position and the entity
field will contain the name of the entity, in this case “creditcard”.
#OptionText
The utterance will be matched against a number of options, and if it does it will be detected as an entity of Name
{
"Config": [
"Amber", //the first value in the array will be what the entity's option evaluates to
"amber",
"#ffbf00",
"ffbf00"
],
"Lang": "en",
"Name": "color_amber",
"Type": "OptionText"
}
If detected, the entity will be added to the state’s entities array. The sourceText
field will contain what the user typed in the entity’s position, the option
field will contain the first element of the array in config, and the entity
field will contain the name of the entity, in this case “color_amber”.
#Between
The utterance will be checked to see if it is between two words, to be detected as an entity of Name
{
"Config": {
"LeftWord": "left",
"RightWord": "right"
},
"Lang": "en",
"Name": "betweener",
"Type": "Between"
}
If detected, the entity will be added to the state’s entities array. The sourceText
field will contain what the user typed in the entity’s position and the entity
field will contain the name of the entity, in this case “betweener”.
{
start: 0,
end: 25,
len: 26,
accuracy: 0.95,
sourceText: 'email@servisbot.com',
utteranceText: 'email@servisbot.com',
entity: 'email',
resolution: { value: 'email@servisbot.com' }
}
Disambiguation is supported within the NLP worker via the following configuration.
{
"Data": {
"NluConfiguration": {
"DisambiguationConfig": {
"DisambiguationMessage": "Sorry I did not understand that, please select one of the following options",
"AmbiguityDistance": 0.7,
"MaxOptions": 5,
"UserSelectedNoneActions": [
{
"Type": "message",
"Value": "You have selected none."
},
{
"Type": "markup",
"Value": "<TimelineMessage><TextMsg>Please ask me another question</TextMsg></TimelineMessage>"
}
]
}
}
}
}
DisambiguationMessage
- The message used to prompt the user to select an intentAmbiguityDistance
- The distance between the confidence values to determine if the the response from the NLU engine is ambiguous, e.g. with an AmbiguityDistance
of 0.2 and a confidence score of .8 on intent A and a confidence score of 0.7 on intent B, the result is considered ambiguous.MaxOptions
- The max number of options to present to the user if classification confidence of multiple intens are within the AmbiguityDistance
UserSelectedNoneActions
- An array of botnet actions to execute if the user select none of the presented ambiguous intents. These are also executed if the user types a response to the bot.