Hi all,
I would like to know how I could reset slots during form validation.
I am trying to validate the slot pizza_type
by:
class ValidateStandardForm(FormValidationAction):
def name(self) -> Text:
return "validate_standard_form"
def validate_pizza_type(self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict) -> List[Dict[Text, Any]]:
pizza_type_db = ['salami', 'tuna', 'wurstel', 'pepperoni']
slot_pizza_type = tracker.get_slot("pizza_type")
flag = 0
for pizza in slot_value:
if pizza not in pizza_type_db:
flag = 1
dispatcher.utter_message(f"!!!{pizza} is not a valid pizza type!!!")
if flag == 1:
return [SlotSet("pizza_type", []), SlotSet("pizza_quantity", [])]
else:
return [{"pizza_type": slot_pizza_type}]
I have noticed that is not possible to reset the slots pizza_type
and pizza_quantity
using SlotSet()
, also the action server gives this warning message:
UserWarning: Cannot validate `pizza_type`: make sure the validation method returns the correct output.
f"Cannot validate `{slot_name}`: make sure the validation method "