Reputation:
Using vanilla Rasa NLU will cause Rasa core to make use of the outputs of the highest probability of an intent or entity value. In other words, even if the probability of an intent is low, and yet it is the highest of all the options, it is still taken by Rasa core as the intent the user is conveying. How do I make it so that Rasa core performs a default action if the probability of the maximum probability intent provided by the NLU is below a certain threshold, say 5%?
Upvotes: 0
Views: 2687
Reputation: 2144
Simply you can do it in two steps
Step 1 In domain.yml
file
actions:
- action_default_fallback
Step 2 In action.py
file
class ActionDefaultFallback(Action):
def name(self):
return "action_default_fallback"
def run(self, dispatcher, tracker, domain):
dispatcher.utter_message("Sorry, I couldn't understand.")
Now, whenever intent classification confidence will be below a certain threshold, this default action will execute.
Resource:
Upvotes: 0
Reputation: 1226
We can achieve this by adding FallbackPolicy
in policies file. For eg:
policies:
- name: "FallbackPolicy"
nlu_threshold: 0.1
core_threshold: 0.1
fallback_action_name: "fallback_action"
Upvotes: 1
Reputation: 631
This feature was added recently and is called Fallback Policy.
See documentation here: https://core.rasa.com/patterns.html?highlight=fallback%20policy#fallback-default-actions
Upvotes: 0