Dear Team,
When using FormAction to fill the slot and to generate same utterance when the expected value in the slot is not filled-- Utterance is not getting generated repeatedly
Error Log DEBUG:rasa_core_sdk.forms:Trying to extract requested slot ‘gender’ … DEBUG:rasa_core_sdk.forms:Got mapping ‘{‘type’: ‘from_entity’, ‘entity’: ‘gender’, ‘intent’: [], ‘not_intent’: []}’ DEBUG:rasa_core_sdk.forms:Failed to extract requested slot ‘gender’ ERROR:main:Failed to validate slot genderwith action <bound method ProductSearchForm.name of <actions.ProductSearchForm object at 0x7fa4bbc37f60>>
Content of Action file
def validate(self, dispatcher:CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict]:
"Validate extracted requested slot else raise an error"
# extract slots that are not requested but set by corresponding entity
slot_values = self.extract_other_slots(dispatcher, tracker, domain)
#extract requested slot
slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
if slot_to_fill:
slot_values.update(self.extract_requested_slot(dispatcher, tracker, domain))
if not slot_values:
raise ActionExecutionRejection(self.name(),
"Failed to validate slot {0}"
"with action {1}"
"".format(slot_to_fill, self.name))
for slot, value in slot_values.items():
print(slot)
print(value)
if slot_values[slot] == 'gender':
if value.lower() not in self.gender_db():
dispatcher.utter_template('utter_wrong_gender', tracker)
slot_values[slot] = None
return [SlotSet(slot, value) for slot, value in slot_values.items()]