Contradicting rules or stories found rasa 2.8.16

Hello!

Faced such a problem when adding a history for the value of a category slot.

InvalidRule: Contradicting rules or stories found

  • the prediction of the action ‘utter_system.how_create_bank_card’ in story ‘system.how_create_bank_card’ is contradicting with rule(s) ‘activate_passport_form’ which predicted action ‘passport_form’. Please update your stories and rules so that they don’t contradict each other.
rules:
- rule: activate_passport_form
  steps:
  - intent: system.how_create
    entities:
    - name: passport
  - slot_was_set:
    - name: passport
  - action: passport_form
  - active_loop: passport_form

- rule: submit_form
  condition:
  - active_loop: passport_form
  steps:
  - action: passport_form
  - active_loop: null
  - action: action_passport_form_message
stories:
- story: system.how_create
  steps:
  - intent: system.how_create
  - action: utter_system.how_create

- story: system.how_create_purse
  steps:
  - intent: system.how_create
    entities:
    - name: purse
  - slot_was_set:
    - name: purse
  - action: utter_system.how_create_purse_in_standard

- story: system.how_create_bank_card
  steps:
  - intent: system.how_create
    entities:
    - name: bank_card
  - slot_was_set:
    - name: bank_card
  - action: utter_system.how_create_bank_card

The problem is that the form is launched with the value of the “bank_card” slot, although according to the rule it should not. Without specifying a slot or with its value “purse” everything works fine. Please tell me what is the problem.

Rasa Version      :         2.8.16
Minimum Compatible Version: 2.8.9
Rasa SDK Version  :         2.8.4
Rasa X Version    :         None
Python Version    :         3.8.5
Operating System  :         Linux-5.4.0-66-generic-x86_64-with-glibc2.29
Python Path       :         /home/rasa/venv/bin/python3strong text

Hi! :smiley:

I think the problem is here:

rules:
- rule: activate_passport_form
  steps:
  - intent: system.how_create
    entities:
    - name: passport
  - slot_was_set:
    - name: passport
  - action: passport_form
  - active_loop: passport_form
stories:
- story: system.how_create
  steps:
  - intent: system.how_create
  - action: utter_system.how_create

You said one thing in rules and others in your story.

The bot (rasa) don’t know what’s to do when identify system.how_create user intent.

Can you suggest how to fix this? I need the form to run only when the “passport” entity is specified, but at the same time it is necessary that the bot correctly handle cases when the entity is not specified at all or when other categories of the slot are specified.

I think you can do it using conditions in stories or make some custom action to check the slot.

Look these examples. I think will help you :smiley:

thank you very much)

1 Like