How to ignore intent detection when inside a form

Hi,

I have a Rasa form called rant_form. Here we ask the user if they want to rant and allow them to type whatever they want. I also have an insult intent in my rules.

Currently, when the rant_form is activated and the user types something that is predicted as “insult” intent, the form gets deactivated and the insult story gets triggered. That’s not what I want, I want any input, regardless of the intent predicted, if it’s said withing the rant form, to be saved in my rant slot.

Here is my domain.yml:

slots:
  rant1:
    type: text
    influence_conversation: false
    mappings:
      - type: from_text
        conditions:
          - active_loop: rant_form
            requested_slot: rant1
  
  rant2:
    type: text
    influence_conversation: false
    mappings:
      - type: from_text
        conditions:
          - active_loop: rant_form
            requested_slot: rant2

forms:
  rant_form:
    required_slots:
      - rant1
      - rant2

Here is stories.yml:

- story: Rant
  steps:
  - intent: rant
  - action: rant_form
  - active_loop: rant_form
  - slot_was_set:
    - requested_slot: rant1
  - slot_was_set:
    - requested_slot: rant2
  - active_loop: null
  - action: action_submit_rant

Here is rules.yml:

- rule: Insult 1
  steps:
  - intent: insult
  - slot_was_set:
    - insult_counter_featurized: 1
  - action: action_first_response_insult

- rule: Insult 2
  steps:
  - intent: insult
  - slot_was_set:
    - insult_counter_featurized: 2
  - action: action_second_response_insult

Does someone have any idea how can I disable intent detection when within the form?

I tried removing insult flow from rules, but that didn’t help. And adding from_intent to the slot mapping didn’t fix it either.

1 Like

Hi @llotus_eater,

I had faced this similar problem and I did solve it by using condition inside the rules.yml file.

You can either use a condition in the rules.yml or you can go in a complicated way to solve this problem. I have solved this problem in multiple ways. You can see it in my Github. Here is it: (https://github.com/RifatUllah102/DISHA_An_Advanced_Humanoid_Assistant_Modified_Version/tree/main/data)

Please beware that I had created the bot for English and Bengali language so you might not get some words but that’s ok. Please let me know if I can help you further.

- rule: Insult 1
  condition:
  - active_loop: null
  steps:
  - intent: insult
  - slot_was_set:
    - insult_counter_featurized: 1
  - action: action_first_response_insult
- rule: Insult 2
condition:
  - active_loop: null
  steps:
  - intent: insult
  - slot_was_set:
    - insult_counter_featurized: 2
  - action: action_second_response_insult
2 Likes

Hi @Rifat, thank you! It’s a great idea, I will try it.

For now I kind of solved my issue by resetting the featurized insult_counter_featurized slot if insult intent is triggered within an activated form. That helped to avoid insult flow being triggered.

And I think your solution should also probably work, I’ll give it a go.

2 Likes