Condition with value in rules?

Hi, I’m trying to set a condition using values in rules but I’m having some trouble.

- rule: Caso feedback positivo agradece e finaliza
  condition:
    - type: slot
      name: feedback_sentiment
      value: "positive"
  steps:
    - action: action_submit_feedback_details
    - action: utter_finish_feedback
YamlValidationException: Failed to validate 'data\rules\rules_feedback.yml'. Please make sure the file is correct and all mandatory parameters are specified. Here are the errors found dur
ing validation:
  in data\rules\rules_feedback.yml:23:
      Key 'type' was not defined. Path: '/rules/2/condition/0'
  in data\rules\rules_feedback.yml:23:
      Key 'name' was not defined. Path: '/rules/2/condition/0'
  in data\rules\rules_feedback.yml:23:
      Key 'value' was not defined. Path: '/rules/2/condition/0'

Where am I getting this wrong?

That’s not the correct format. Try this, as shown in the docs:

- rule: Caso feedback positivo agradece e finaliza
  condition:
  - slot_was_set:
    - feedback_sentiment: "positive"
  steps:
    - action: action_submit_feedback_details
    - action: utter_finish_feedback
1 Like

Oh!

But what’s the difference from here?

responses:
  utter_greet:
    - condition:
        - type: slot
          name: is_new_user
          value: true
      text: "Thank you for signing up! What do you need help with?"

I get that one is a response and the other is a rule, is that it?

And thank you for your reply, I’m a little lost with the structure still. :slight_smile:

That’s right :slight_smile:

Chris, sorry to bother again :bowing_man:.

  • Is there such a thing as multiple conditions (&& and ||) ?

  • Can I put a condition inside a condition? Like, immediately after closing a form doing something if …?

  • And where can I find all conditions types?

Regards

For ||, read about or statements:

  condition:
  - or:
    - slot_was_set:
        - name: Chris
    - slot_was_set:
        - name: Ueno

For &&:

  condition:
  - slot_was_set:
      - name: Chris
  - slot_was_set:
      - age: 23

Sorry I don’t really understand


It’s all in the docs :slight_smile:

2 Likes

Is this the && for conditions in particular working for rules to define dedicated paths?

  • rule: condition:
    • slot_was_set:
      • slot_path: checkpath
    • slot_was_set:
      • slot_pathoption: phase2 steps:
  • intent: intention1
  • action: phase2

or

  • rule: condition:
    • slot_was_set:
      • slot_path: checkpath
    • slot_was_set:
      • slot_pathoption: phase3 steps:
  • intent: intention1
  • action: phase3

ALSO it was not answered if OR statements work

  • rule: condition:
    • or:
      • slot_was_set:
        • name: Chris
      • slot_was_set:
        • name: Ueno

steps:

  • intent: intention1