I have built a chatbot application using Rasa back-end. But I am unable to handle unexpected and Out of Scope Queries.
I tried to build the bot with various intents. When I try asking any question related to the intents already trained with, I am getting accurate results. But when I ask a question related to something out of the scope of the bot, it randomly takes up an intent and returns the answer for it, or the bot enters an infinite processing loop.
Also, when I give unexpected queries like only numbers or random strings, the same as above happens.
Whenever a query which is out of the scope is asked or an unexpected query is asked, I want the bot to return some string like: 'I am not trained for such queries'.
You need to add the
FallbackClassifier
to the pipeline in your config.yml. This will allow you to make use of thenlu_fallback
intent.config.yml:
rules.yml:
When a user makes a query with an intent confidence <=
threshhold
, the intentnlu_fallback
will be triggered. This intent can be used to handle low confidence queries in a controlled way via a rule or story.The value of
threshold
should be set in accordance to the results of testing the confidences of your intents.