HomeGuidesAPI ReferenceChangelogsDiscussions
GuidesChangelogsAPI ReferencePublic RoadmapService StatusLog In

NLU bypass

What is NLU bypass?

In some specific cases you may want to capture a text that is not necessarly in your intents. It can be a problem description, the user name, an address,... any unpredictable text
In thoses cases you will want to bypass the NLU and continue the dialog whatever the user message

How can I use it?

Here is how you can do it

In your dialog flow, at the step where you need to ask for free text, add a "Bot Sows" object.

Then click on Show more options to view the advanced settings

Activate the NLU bypassing feature and define a bypass phrase.
Note: This phrase will be used by the NLU instead of the real user input so pick a quite complex phrase that should not come easily in the discussion. in this case we have chosen Free text NLU bypass phrase which has really small chances to occur accidentally in a conversation.

Now we can add the next steps of our dialog flow with the following objects:

  • a "User says" object to detect the bypass phrase
  • a "Bot says" as the next bot answer, you can keep it empty
  • a "Bot does" where you put two lines of code to capture the real user input and use it as you want

We create an intent with the exact same bypass phrase that you have defined before and train your bot.

Here is a sample code that you can use in your "Bot does" object. Most important thing to remember is that the user input will be available in a variable called output.input

var name = output.input;
output.answer = 'Nice to meet you ' + name;

Once finished, here is the result that you will get.

Pretty cool huh?
Although your bot has never been trained to learn first or last names, he will accept the text provided by the user in this context as a name and smoothly continue the conversation 🙂

Can I activate NLU Bypass programatically?

Absolutely, simply add the folling code in a custom code node:

output.payload.next_intent_is_any = true;
output.payload.sentence_for_intent_any = "the sentence you want to send to the bot";

Note that in this case as with the GUI, you can accept any text at a given point using the code above, and in all case the bot will look for an intent with the input sentence_for_intent_any to continue the conversation flow so don't forget to have this sentence in your intent and your bot properly trained.