Hi!
A slot was defined in domain and filled ‘from_entity’. ‘ValidatePredefinedSlots’ Class was created to validate the slot value.
Below are the details:
domain: slots: var_num: type: text mappings: - type: from_entity entity: var_num intent: compare_indepgroups not_intent: info_test
actions:
- action_validate_slot_mappings
- action_compare_indepgroups
responses: utter_ask_var_num:
- text: How many independent groups you want to compare?
action.py
class ValidatePredefinedSlots(ValidationAction):
def validate_var_num(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate var_num."""
num = tracker.get_slot("var_num")
if num is None:
dispatcher.utter_message(response="utter_ask_var_num")
return {"var_num": None}
return {"var_num": num}
class ActionCompareIndepgroups(Action):
def name(self):
return 'action_compare_indepgroups'
def run(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
var_num = tracker.get_slot('var_num')
alpha = ['one', 'two', '1', '2']
if var_num in alpha:
dispatcher.utter_message(response="utter_compare_2indepgroups")
else:
dispatcher.utter_message(response="utter_compare_MoreThan3indepgroups")
return [SlotSet("var_num","")]
rules:
- rule: Compare Independent Groups
steps:
- intent: compare_indepgroups
- action: action_validate_slot_mappings
- action: action_compare_indepgroups
Problem: The action_validate_slot_mappings is being called, but the function did not run. Did I miss something?