Recommended method to repeat last bot action when it does not recognize user message

I want my Rasa bot to repeat the last action (excluding action_listen, of course) if it is unable to recognize a user message. I want it to repeat this for N (e.g. 2) times. Even after repeating N times, if the bot is unable to recognize the user message, I will send a custom message and end the conversation.

As per my understanding, I think that I will have to use a custom action for the fallback intent.

What would be the possible way(s) to go about doing this? Which is recommended?

Thanks.

1 Like

You might want to check out Two Stage Fallback Poplicy

Thank you for your response. I did have a look at Two Stage Fallback Policy. But I wonder if it is suitable for this particular use case?

As far as I undertand, I can customize the utter_ask_rephrase message. But how do I get the last bot utterance, and more importantly, how do I make sure that the bot repeats the question N number of times only?

Hi @aravindashok.
I’m a new Rasa beginner. I have same idea with you
Did you solve this problem? Please give me some recommendations :(( Thanks

1 Like

Hi @DLH06,

I think you can resolve this using form actions to ensure that same action is repeated until all slots are filled. Let’s assume, the purpose of the action command is to retrieve boolean reponse from user (Yes/No) and user is giving somewthing else, Form action will ensure that same action is repeated till the slot is filled. I hope this might answer your question?

Ya. I get it bro
But i wanna define like it will be repeated only three times and if wrong more, my bot can cancel it. So might i need to declare a new slot to count how many times the question is repeated? And I can set rule for it.

Hi @aravindashok, I’ve the same Issue. I planned to try to create a custom fallback action from where I call the previous action. It’s working but problem is it call the last action multiple time. Here’s what I did.

create a global variable in your action file. In my case, I created last_action = “” then every action except fallback you store the action name in this variable. In the fallback action, you will check the get the last action’s name in the last_action variable. Let me know how did you solve as I’ve a similar problem. Thanks.

@shaiful019 i am also facing the same issue can you help me how to call previous action?