rasa: Invalid rule when training when setting a slot of type float

Rasa version: 2.0.3

Python version: 3.7.9

Operating system: Ubuntu 18.04

Issue: I have two rules which start with the same action but have different behaviors depending on the value of the slot that has been set. The slot (matches_found) is of type float with a min of 0 and a max of 1. The rules fail to be validated with the following error (full error below): the action 'action_search' in rule 'Search with results' does not set all the slots, that it sets in other rules: 'matches_found'.

If I use a different type of slot (a boolean slot for example), it does not throw an error. Even if I set matches_found to the exact same value in both rules, it still fails.

Rules

version: "2.0"
rules:
- rule: Search with results
  steps:
  - action: action_search
  - slot_was_set:
    - matches_found: 1
  - action: action_display_apt_selector

- rule: Search without results
  steps:
  - action: action_search
  - slot_was_set:
    - matches_found: 0
  - action: action_no_search_results

Error (including full traceback):

InvalidRule: 
Incomplete rules found🚨

- the action 'action_search' in rule 'Search with results' does not set all the slots, that it sets in other rules: 'matches_found'. Please update the rule with an appropriate slot or if it is the last action add 'wait_for_user_input: false' after this action.
- the action 'action_search' in rule 'Search without results' does not set all the slots, that it sets in other rules: 'matches_found'. 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.
You can find more information about the usage of rules at https://rasa.com/docs/rasa/rules. 

Command or request that led to error:

rasa train core

Content of configuration file (config.yml) (if relevant):

policies:
  - name: TEDPolicy
    max_history: 7
    epochs: 5
  - name: MemoizationPolicy
    max_history: 5
  - name: RulePolicy

Content of domain file (domain.yml) (if relevant):

slots:
  matches_found:
    max_value: 1
    min_value: 0
    type: float

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (18 by maintainers)

Most upvoted comments

Hi @nbeuchat, does this mean we can close this issue? It sounds like between this and the other issue we’ve managed to resolve the errors/bugs

Oh, that is very likely the case of the bug with the two error messages then. When I retried this afternoon, I removed every single slot except matches_found and removed every rules except the ones around the apartment search and I did not have the bug again.

I didn’t have time to install Rasa from the PR #7235 to see if that fixes all the issues.

@nbeuchat having read through this, it’s a very interesting bug and good luck to @koernerfelicia fixing it!

I though I’d just add my piece of understanding of the syntax for rules: I think the name slot_was_set should ideally communicate that the slot is not being set by the rule, but that it was set by the action that comes before in the rule.

Second: By including slot_was_set as a step in your rule, you’re basically conditioning the rest of the rule on the specific slot value, which works, but I personally find it a bit dangerous in that it can lead to very hairy rules very quickly. Personally, I prefer to stop the rule after the action that sets the slot in question and write new rules for the different slot values as @davidhsv has shown in their workaround. If nothing else, this second approach makes the conditions more explicit (by using the condition block) and hopefully harder to get lost in 😃

This being said, @nbeuchat all of your examples make sense to me and are in line with what the docs are saying, so we should definitely fix the issues…

I changed the slots.py in the rasa library (not optimal at all hahahahah).

I’m making the pull request with the related tests for that issue.

Yes, it’s working 😃

I can now differentiate between slot: null, slot: ‘text1’ and slot: ‘text2’.

But I still can’t differentiate - slot_was_set -slot_name (without any value)

And yeah, you are right the default is true for influence_conversation, sorry.

Going to debug your problem now.

Same problem with type text