Hi all,
I have two slots start_date
and end_date
inside a form.
I have defined those slots in the expected order inside
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return [
"start_time",
"end_time"
]
This is my slot mapping
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"start_time": [
self.from_entity(entity="provide_date"),
self.from_text()
],
"end_time": [
self.from_entity(entity="provide_date"),
self.from_text()
]
}
and I have following validators for each slot
def validate_start_time(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any], ) -> Dict[Text, Any]:
print("Validating start time")
def validate_end_time(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any], ) -> Dict[Text, Any]:
print("Validating end time")
But the application selects the validate_end_time
to validate the start_time slot.
But the strange thing is, if I change the slot mapping to the following, it works fine. The validators are picked as expected.
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"start_time": [
self.from_text()
],
"end_time": [
self.from_entity(entity="provide_date"),
self.from_text()
]
}
Does the validator selection depend on slot mapping? I expected to follow the requested slot order. I appreciate your input on correcting this behavior.
Note: the requested_slot
order is working as expected despite the wrong validation order