Ignore optional slots in form depending on condition


I am developing a security bot which has a form called security_form with a series of questions used to determine the users’ identity. Each question has a specific score assigned to it, and once the bot reaches a score of 10, I have to exit the form.

After racking my brain for several days, I am unable to find an elegant solution to do this. So far I have explored two options: one, to fill the remaining slots manually in my validate action once the score is reached. However, this is hardly efficient as in case of a large number f slots, my code will become unmanageable.

Second is raising an ActionRejectionExecution, however, this too is not feasible as my bot will forget the most recent slot since I am not returning a SlotSet event.

Is there any way to solve this? Thanks in advance

I’d recommend overriding the required_slots method to add your custom logic to dynamically set which slots are required. Forms

Hi Will,

Thanks for the quick response. I had a look at the docs and the Rasa GitHub code, and I think I understand the solution, but just to re- confirm, if I override the required slots method and pass the currently filled slot as the parameter, it should stop asking me for the remaining slots and will exit out of the form even if they are unfilled, right?

Will try it out once I get back to work. Thanks for the help! :slightly_smiling_face:

1 Like