Compatibility between rules and forms?

I know the documentation states that rules are ignored inside forms, so I am brainstorming workarounds. I have an entity emotion as well a slot with the same name, so that it is filled automatically whenever the entity is extracted. I also have a custom action, action_emotional_grounding, which I want to call whenever the emotion slot is set. However, my conversation consists almost exclusively of a sequence of forms, meaning that this rule:

- rule: Emotional grounding
  condition:
  - slot_was_set:
    - emotion: anything
  steps:
  - action: action_emotional_grounding
  - slot_was_set:
    - emotion: null
  wait_for_user_input: false

is useless. The only workaround I can think of is to have something like this:

- rule: Emotional grounding
  condition:
  - active_loop: <form_name>
  steps:
  - intent: inform
  - slot_was_set:
    - emotion: anything
  - action: action_emotional_grounding
  - slot_was_set:
    - emotion: null
  - action: <form_name>
  - active_loop: <form_name>
  wait_for_user_input: false

for every form. But this seems highly inefficient.

Any ideas?

Hi @alexyuwen, what if you made a validation method for the slot emotion, and trigger the action from there using a followup event? I haven’t tested this, but I think it could work.

1 Like

Thank you for this suggestion, I didn’t think of this. I will try it out.

1 Like