Custom actions not working since last update (if - else statement only takes else) - Rasa Open Source - Rasa Community Forum
👋 Introducing the Rasa Playground
Custom actions not working since last update (if - else statement only takes else)
post by jbrix on Dec 6, 2020
I use a form and check if the content of the slots matches with the symptoms for a cold, if not it matches with symptoms with a flu. Wich worked fine during the last weeks. Today I updates Rasa X (now 0.34.0) and Rasa (now 2.1.3) and I get only what happens under “else” although I make my answers true for “if”. I checked multiple times if there could be a typo, but there isn’t. Any ideas?
The actions.py looks like this:
class SymptomQuizDiseases:
cold = [["discomfort_slow", "symptom_light", "false", "false", "feel_listless"], ... ]]
responseCold = "It's a cold."
flu = [["discomfort_fast", "symptom_heavy", "true", "true", "feel_bad"], ... ]
responseFlu = "It's a flu."
class SymptomQuizSubmission(Action):
def name(self):
return "submit_symptom_quiz_result"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict
):
slot_list = [tracker.get_slot("discomfort_beginning"),tracker.get_slot("discomfort_development"),tracker.get_slot("temperature"),tracker.get_slot("body_aches"),tracker.get_slot("physical_condition")]
if slot_list in SymptomQuizDiseases.cold:
dispatcher.utter_message(SymptomQuizDiseases.responseCold)
else:
dispatcher.utter_message(SymptomQuizDiseases.responseFlu)
return []
The form part of my domain.yml
forms:
symptom_quiz_form:
body_aches:
- intent: affirm
type: from_intent
value: true
- intent: deny
type: from_intent
value: false
discomfort_beginning:
- intent: feel_bad
type: from_intent
value: discomfort_fast
- intent: slow
type: from_intent
value: discomfort_slow
discomfort_development:
- intent: feel_bad
type: from_intent
value: symptom_heavy
- intent: symptom_light
type: from_intent
value: symptom_light
physical_condition:
- intent: feel_bad
type: from_intent
value: feel_bad
- intent: feel_listless
type: from_intent
value: feel_listless
temperature:
- intent: affirm
type: from_intent
value: true
- intent: deny
type: from_intent
value: false
post by jbrix on Dec 6, 2020
Found the mistake myself: It is now necessary to use bool instead of str in actions.py if I set the value to true or false in the domain.yml
post by Chidi_251 on Mar 18, 2021
Can you please explain this better?