Is there a way to bring back top 10 intents using twostagefallback policy

I would like to use the twostagefallback policy to bring back top 10 intents and not just the next possible intents e.g.

User says something that triggers default fallback: Did you mean {next high score intent} but if user says no, they get a list of the next 10 intents for user to select which one is most relevant.

I don’t think this is currently supported when I check the docs here. I think an easy way forward might be instead to write your own custom action. A custom action receives the detected entities and I’d imagine it receives the intents with scores as well.

Here’s a codesnippet from a custom action that might help.

class ActionPrintMsg(Action):

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

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
            # here you can see everything that we're receiving.
            print(tracker.latest_message)
            dispatcher.utter_message(text="i received information and i am handling it")
        return []

If you feel that this is a missing feature, feel free to start a discussion on github then some of our engineers can also pitch in.

1 Like

I’ll go the custom action route for now. Thanks

1 Like