Form deactivate when user interrupt with another intent

Is it possible to deactivate the form when not all requested slots are filled?

For now, what I see is if the form policy is activated, it can only be deactivated if you fill all requested slots or follow the path action_deactivate_form written in the story. What I need is if the user asked another question (intents other than the answer to slot requesting) are detected, the form can be deactivated, no need to go back to the form. But I don’t want to add all other intents in the deactivate form story like handling chitchat. There will be more intents beside chitchat, I will need to write lots of stories to include all possible other intents.

Are there any solutions or thoughts addressing this problem? Welcome to discuss :slight_smile: Thank you!

1 Like

Why would you need to write other stories? I think in the FormAction you can just maintain a list of ‘interrupt intents’ so if the NLU extracts one of those you can hit the deactivate button and do something else. How you deal with the dialog flow after the deactivation is a bit different and probably will involve having multiple stories (though I don’t think you need to include a full story for each, you can have a story stub end somewhere and another pickup the trail depending on the intent the user ended with)

Does that help?

@damao there’s a self.deactivate method you can call from within the form if you want to stop asking for slots if some conditions are met. We do recommend you write stories for the kind of suggestions like chitchat though, you may want some custom behaviour there.

@Zylatis I mean, you don’t even need to have a list of intents in the form, Core will break out of the form as soon as there’s unexpected input. And then you can handle that in your stories, and even deactivate the form from there if you want

@akelad Ah okay, probably then I don’t understand forms enough. For example, if i had Story A with FormA and i wanted to break out of that form before completion to go to Story B, based on some condition, how would I do that? For example, I understand I can use self.deactivate from within the form, but how do I identify that situation in so I can write a path that includes that outcome?

Thanks! G.

Take a look at this story here: rasa/ at master · RasaHQ/rasa · GitHub

Ah yes thank you, came across that but forgot to update my post :slight_smile:

My error was not re-calling the form after the resumption call and having the error throwing in the form action commented out.


EDIT: Is it also possible to do something like this for more complicated validation of form slots? For example, rather than just a simple pass/fail validation step, if i wanted the validation to be multistep (i.e. they got it on the first try or they’re going to need a lot of help with multiple steps) would it make sense to have the form break out when the validation fails, and then throw a particular utterance, and have this be the branch point of the stories for this path?

thanks all for the replies! I have read your story and rasa blog about chitchat. Construct such stories should help with chitchat. But my problem is slightly different.

My chatbot is mainly served FAQ. For some questions, I have to collect user information to give answer, these are where forms are applied. The problem I have is an incorporate situation for form action, but not with chitchat, but with other intents in my domain. User ask other questions that the bot have answers.

Now, the situation is when the form is interrupted, the nlu can still get user intent correctly, but since the core is in the middle of a form policy, it would not give any action, that is to say, the bot won’t reply to the user. I do want to give a example here, but I cannot share the data due the project contract.

I am not sure I should go more customization or write more stories for this problem.

1 Like

I guess you would probably handle this with stories. It’s hard to give advice if I don’t know what your stories are

Thanks. I will try with stories first



I have encountered the same situation. In my case, a form is opened, which ask for 2 to 3 slots.

But if user wants to end conversation during filling of slots, by typing “end”, i want to deactivate the form, utter bye/thanks message.

I have written stories by interactive learning for this case as mentioned by @akelad but some how it is not working.


  • intent_greeting
    • action_greet
  • intent_submit_incident_main
    • utter_ack_incident
  • intent_affirm
    • utter_incident_project
    • project_and_date_form
    • action_predict_incident_type
  • intent_hazard_type_response
    • action_ask_picture
  • intent_deny
    • utter_injury_involved
  • intent_deny
    • injury_form
    • utter_thanks

Generated Story -2742792770334879928

  • intent_greeting
    • action_greet
    • reset_slots
  • intent_submit_incident_main
    • utter_ack_incident
  • intent_affirm
    • utter_incident_project
    • project_and_date_form
    • form{“name”: “project_and_date_form”}
  • intent_end
    • action_deactivate_form
    • form{“name”: null}
    • slot{“requested_slot”: null}
    • utter_bye

Following is image for run time events after I enter end in response to a “Project slot” value, instead of ending the conversation the bot is asking for next value. Am I missing some thing?

How do you have your form defined?

Let me create the scenario again and get back to you.

Hello from the future :stuck_out_tongue:

It looks like, in version 1.5.3, in order for the unhappy paths to work, you have to edit the following function named slot_mappings, which is a method of the FormAction class.

def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
    """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked"""

    return {
        "form_slot1": self.from_text(not_intent="intent_end"),
        "form_slot2 ":  self.from_text(not_intent="intend_end")

For me, the interruption of the Form wouldn’t work unless I specified all the interrupting intents as “not_intents”, as in the example above.

Hi Akelad , I have small problem , ?+