Out of Scope and Unexpected Query Handling in Rasa Chat Bot Application

173 views Asked by At

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'.

1

There are 1 answers

0
Leo Guagenti On

You need to add the FallbackClassifier to the pipeline in your config.yml. This will allow you to make use of the nlu_fallback intent.

config.yml:

pipeline:
  - name: FallbackClassifier
    threshold: 0.3

rules.yml:

- rule: handle low confidence query
  steps:
    - intent: nlu_fallback
    - action: action_fallback

When a user makes a query with an intent confidence <= threshhold, the intent nlu_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.