Rule Policy ignores intent when intent have entity

Hi! I have some troubles with the Rule Policy.

We have a rule which redirects user to the operator if there is no stories for user’s intent. And Rule Policy works fine with intents. But if there is an entity (which fills the slot which influence the conversation) in the intent, Rule Policy doesn’t find applicable rule and pass decision on what to do to TED, and TED gives some crasy responses.

Here is the rule, under or statement listed almost 200 intents

rules:
  - rule: rule_no_stories
    steps:
      - or:
          - intent: intent1
          - intent: intent2
          - intent: intent3
          ... 
      - action: utter_no_stories

How can I handle this situation? Should I write another rule where entity and slot is listed under every intent from this rule? And why Rule Policy acts like that?

Hi! This is expected behaviour, because you have set your slot to influence the conversation. You can ignore the entities by setting the slot to influence_conversation: false

And why Rule Policy acts like that?

We allow slots to influence the conversation (and influence the rules) so that you can have different rules based on slot values:

rules:
- rule: Welcome premium user
  condition:
    - slot_was_set:
       - premium_account: true
  steps:
   - intent: greet
   - action: utter_welcome_premium

- rule: Welcome basic user
  condition:
  - slot_was_set:
     - premium_account: false
  steps:
   - intent: greet
   - action: utter_welcome_basic

Read more about this here

Thank! Your answer made the problem clear. But I had the following question: could I write rules with condition: slot_was_set, but without specifying the value of the slot, if this slot is categorical, just to check if slot is not empty?

Like this:

- rule: rule_no_stories
  condition:
  - slot_was_set:
     - DEVICE
  steps:
      - or:
          - intent: intent1
          - intent: intent2
          - intent: intent3
          ... 
      - action: utter_no_stories

You’re welcome! Unfortunately, if you want the slot to affect the conversation (this includes just checking whether it’s set or not), you’ll have to write a rule for every slot value. We are considering allowing “OR” for slots, but this is still in discussion.

If it’s set to influence_conversation: true, then you’d have to do it for every possible value of the slot. If it’s not set to influence_conversation the rule will apply whether or not the slot is set.

If you have very many values for the slot, but you still want the rule to apply only if the slot is set, you could get around writing a rule for each value of the slot by creating another slot. This would be a boolean: true if the slot DEVICE was set, and false if the slot DEVICE was not set. You can have this boolean slot set internally, in a custom action triggered (for example) by the intent used to set the DEVICE slot. Let me know if you have questions about this last part.

But DEVICE slot sets by entity. Is there any way to get around in this case? Seems like boolean slot wouldn’t help

Is the DEVICE slot part of a form? If yes, you can use FormValidationAction, which will be triggered when DEVICE is set. Otherwise, you can write a custom action that behaves similarly.

The boolean slot helps because you would only have to write two rules, one for when the slot is set, and one for when it isn’t.