Condition with value in rules? - Rasa Open Source - Rasa Community Forum
👋 Introducing the Rasa Playground
Condition with value in rules?
You have selected 0 posts.
4.4k views 4 links
post by al777 on Dec 17, 2021
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 during 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?
post by ChrisRahme on Dec 17, 2021
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
post by al777 on Dec 17, 2021
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.
post by ChrisRahme on Dec 17, 2021
That’s right
post by al777 on Dec 17, 2021
Chris, sorry to bother again .
- 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
post by ChrisRahme on Dec 17, 2021
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
post by stritchi on Apr 2, 2022
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:
- slot_was_set:
- intent: intention1
- action: phase2
or
- rule:
condition:
- slot_was_set:
- slot_path: checkpath
- slot_was_set:
- slot_pathoption: phase3 steps:
- slot_was_set:
- 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
- slot_was_set:
- or:
steps:
- intent: intention1