CSML Studio allows you to use your own pre-trained Natural Language Processing (NLP) service directly in your CSML chatbots with very little configuration. You can easily setup your favorite NLP provider in AI & NLU > NLU Configuration:
By default, all bots run in Strict Mode
, where the input needs to exactly match one of the given rules to trigger a flow.
When a NLP provider is configured, all text
events will be sent to the NLP provider and returned either as a payload
event if an intent is found, or untouched if no intent is found. When an intent is found, the value of the payload will be intent:nameOfIntent
.
No matter what NLP provider you pick, any event that passes through this process will have the following properties:
A few additional properties are also set in the resulting event:
event._nlp_provider
: contains details about the NLP provider integration
event._nlp_result
: contains the raw response from the NLP provider
event.text
: contains the original text input
You can now use the event by matching a found intent with a flow command, by setting that intent as one of the accepted commands for a flow, using the AI Rules feature.
Alternatively, you can also decide to match buttons or other actions within a flow with the found data. For instance, you can use NLP to detect a YES_INTENT
and match it without having to list all the possible ways to say "yes" in the button's accepts
array.
Caveat: when using a NLU provider, CSML Studio will send all text events to that provider, adding some additional delay in the request handling. If you don't need NLU for your use case (and many great chatbot use cases don't need any NLP), you also don't need to setup a NLU provider. This is completely optional.
CSML Tip: except in very specific scenarios, you should not map your NLU provider's default or fallback intent to a CSML flow, as this would result in a behavior where every input that is not a detected intent triggers that flow. Instead, fallback intents should continue any currently open conversation or automagically fallback to the default CSML when needed.
CSML Studio currently supports the following NLP providers:
Dialogflow (read our blog post)
SAP Conversational AI (formerly Recast.ai)
Amazon Lex
Microsoft LUIS
Rasa
Wit.ai
IBM Watson
Custom Webhook
Please refer to each provider's documentation for more information on how to generate credentials. CSML Studio supports the most common and secure way of connecting to these providers.
If your favorite provider is not in this list, please reach out to contact@csml.dev.
You can also add a custom NLP engine by using the custom Webhook integration. This is especially useful if we don't currently support your NLP provider of choice or if you are running your NLP services on premise.
To use the Webhook integration, simply provide a URL that we can send a POST request to, with the following body:
The URL may contain query parameters, for example with an API Key for authentication purposes.
When called, this endpoint must return the response in the following form:
You can test this endpoint directly on the configuration page.
In the AI Rules section of CSML Studio, you will find a way to configure flow commands for any of your flows. This section makes it easy to see in one single screen all the rules that govern the triggering of any of your flows!
Commands are words or sentences (or intents, when NLU is configured) that will trigger a given flow. For example, in the example below, if a user says "Hi"
, no matter where they are in the bot, they will be redirected to the Welcome
flow:
You can have as many AI Rules as you want on as many flows as you want. The commands are case-insensitive, so for example "Hi"
, "hi"
, "HI"
and "hI"
will all trigger the Welcome
flow. Also, if the same rule is used as an input to two different flows, the triggered flow will be randomly chosen among the target flows.
This feature can also be used in conjunction with any Preprocessing or NLP configured in your bot. For instance, if after going through a NLP service, an intent is detected, the intent name can be used as a command for any given flow (with the intent:
prefix, i.e intent:myIntentName
). For instance, this is how an intent called DemoContext
would be handled with AI Rules: