I’m struggling with Twostage fall back to handle with random input, I already executed Fallback for the fallback nlu which listed in NLU.yml. I also create a Two stage fallback using fallback trigger slot with float value.
from typing import Any, Dict, List, Text from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.events import SlotSet
class TwoStageFallbackAction(Action): def name(self) → Text: return “action_fallback”
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
fallback_triggered = float(tracker.get_slot("fallback_triggered"))
print("---------slot--------",fallback_triggered)
if fallback_triggered == 0.0:
dispatcher.utter_message(text="1s")
return [SlotSet("fallback_triggered",str(fallback_triggered + 1.0))]
else:
dispatcher.utter_message(text="2")
Here are my action, any suggestion to imporve it to detect with latest intent. Thanks in advance