How to understand the steps of submit form

This is the rule rasa document say how to subscribe a custom action when submit a form:

rules:
- rule: Submit form
  condition:
  # Condition that form is active.
  - active_loop: restaurant_form
  steps:
  # Form is deactivated
  - action: restaurant_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  # The actions we want to run when the form is submitted.
  - action: utter_submit
  - action: utter_slots_values

But I find it is hard to understand the steps. The condition is ok, form is active. I am confused from the first step. From my understand, I will write the rule as this:

rules:
- rule: Submit form
  condition:
  - active_loop: restaurant_form
  - slot_was_set:
    - requested_slot: null
  steps:
  - action: utter_submit
  - action: utter_slots_values

That means when restaurant_form is active and slots are all filled, then submit it.

1 Like

I agree, the second is more intuitive :slight_smile:

But it’s just the syntax Rasa uses and we have to deal with it :joy:

On a more serious note, the first syntax is more effective in case something happens before required_slots is set not null. Maybe you don’t want to submit if two certain intents follow each other, or something like that.

What I recommend doing is setting this one rule, and then if you want to introduce more complexity to the stories, do so via interactive learning.

That’s ok. So why first step action: restaurant_form means Form is deactivated?

restaurant_form is an action that gets triggered everytime the user fills a slot.

After filling the last slot, the user will trigger restaurant_form which will set the requested slot to None/null.

Great, thank you.

1 Like