Incomplete rule problem and rule semantics

Hi, I’m having trouble with this rule:

- rule: some form ending
  condition:
  - active_loop: some_form
  - slot_was_set:
    - some_slot: some_value
  steps:
  - action: some_form
  - active_loop: null
  - action: action_utter_based_on_form_data
  - action: action_reset_slots

action_reset_slots just sends an AllSlotsReset event. Problem is rule doesn’t end with the implicit action_listen action. It’s trying to make another prediction at the end of the rule, and failing, resulting in fallback behaviour when the user hadn’t input anythin after the last bot utterance. I have tried setting wait_for_user_input: true explicitely but it doesn’t work.

Based on this section of the docs, it seems the problem here is that I should explicitely declare the slot changes using slot_was_set. I only have one slot that has influence_conversation set to true. A categorical one but if I declare it was set to null, rasa train command will complain about incomplete rules. Meaning, if I add some lines at the end:

- rule: some form ending
  condition:
  - active_loop: some_form
  - slot_was_set:
    - some_slot: some_value
  steps:
  - action: some_form
  - active_loop: null
  - action: action_utter_based_on_form_data
  - action: action_reset_slots
  - slot_was_set:
    - some_slot: null
  - action_listen # with or with this line it fails

I get this:

InvalidRule:
Incomplete rules found🚨

- the action 'action_reset_slots' in rule 'some form ending' does not set some of the slots that it sets in other rules. Slots not set in rule 'some form ending': 'some_slot'. Please update the rule with an appropriate slot or if it is the last action add 'wait_for_user_input: false' after this action.
Please note that if some slots or active loops should not be set during prediction you need to explicitly set them to 'null' in the rules.

I’d like to confirm som rule semantics while I’m at it. I initially thought rules just executed everything they had once they were triggered, but looking closer they really seem similar to an AugmentedMemoizationPolicy that last one turn. This is because there doesn’t seem to be a specific trigger, since you can even start rules with an action-intent sequence, so it can’t be that the first step triggers the rest (since it doesn’t make sense for the rule to ‘execute’ an intent). Rather, it seems the rule just tries to match recent tracker states with higher priority than memoization. If this is correct, is the main difference the higher priority?

1 Like