How can I have my bot give 2-3 options based on the top rankings of confidence

When a user gives a wrong input, I want the bot to say the utterance for the fallback intent, and then give the options for intents based on the top rankings of confidence. Is there a way to do this in Rasa? Also can I access the confidence levels through my actions.py file? If so then how?

Thanks for your time!

Hello Ahmed @BrookieHub!

Means, you want to trigger the utter_default_fallback : “Sorry can you asked again?” or " Will you repeat your question?" if the confidence score is less then the mention score in config.yml. It will automatically trigger the fallback. Right?

Further, you want that default fallback every time display a new message if the confidence is low?

Please confirm with me!

Hey thanks for the reply!

No, I want to basically access the confidence score with the actions.py

The double fallback is giving me options, but I dont want it to say “/out_of_scope” instead something human understandable like “Out of Scope”. Thats what I’m aiming for.

@BrookieHub means you to see the confidence score only?

@BrookieHub Last point I still not get it, fallback is similar to out_of_Scope only, but still me not clear on that.

@BrookieHub [Solution] You can check the trackers.events

Demo snippet code for your reference but you need to write the python code for the same, please first check the output of this code as it is based on JSON Data (Key-Value pair) and main data is reside in metadata, when you see the output you will get to know what I mean.

class ActionSaveConversation(Action):

    def name(self) -> Text:
        return "action_save_conversation"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        conversation = tracker.events
        print(conversation)
         return []

I hope this will solve your issue.