I need some help with my fallback policy!
My plan is to give the user two opportunities to rephrase when the NLU confidence threshold is not met. However, when using plain fallback policy this can get the user stuck in a story, so I would like to switch to a different fallback action (a custom action that utters an apologetic message and uses action_restart as a follow up action) when the fallback message has been given twice.
Is there any way to do this in Rasa?
Two stage fallback would not work for me, since my intent names are in a different language than the rest of the bot, so the suggestions would not make sense for the user.
Thanks!
Hi @AoibhinnRed
If you are looking for a custom action to do
from rasa_sdk.events import Restarted
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
dispatcher.utter_message(template="utter_happy")
return [Restarted()]
This code will utter template message and restart the slots as well as conversation.
Hi @MuraliChandran14!
This is great already, thank you!
I was also wondering if it is possible to get a fallback action (just the default) when the NLU confidence is low, but after giving the user two attempts to rephrase, then switch to this custom action.
Is it possible to use twostage fallback for this?
Thanks!
@AoibhinnRed
Yes, Its possible
Fallback actions
You can do like this
policies:
- name: "FallbackPolicy"
nlu_threshold: 0.4
core_threshold: 0.3
fallback_action_name: "action_default_fallback"
policies:
- name: TwoStageFallbackPolicy
nlu_threshold: 0.3
core_threshold: 0.3
fallback_core_action_name: "action_hello_world"
fallback_nlu_action_name: "action_hello_world"
deny_suggestion_intent_name= "out_of_scope"
This worked for me, thanks!