Rasa Slots Acting Funny

Hi @Tobias_Wochinger! Thank you for the compliment! I tried adding validation to the sugar and cream inputs and it is still acting the same way. However, I do like having an int validation in place.

Here is my form:

class CoffeeForm(FormAction):
    """Form action to capture contact details"""

    def name(self):
        # type: () -> Text
        """Unique identifier of the form"""
        return "coffee_form"

    @staticmethod
    def required_slots(tracker):
        # type: () -> List[Text]
        """A list of required slots that the form has to fill"""
        return ["customer_name", "blend", "num_sugar", "num_cream"]

    def submit(self, dispatcher, tracker, domain):
        # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
        """Define what the form has to do
           after all required slots are filled"""

        dispatcher.utter_template('utter_coffee_confirm_order', tracker)
        return []

    def slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        """A dictionary to map required slots to
            - an extracted entity
            - intent: value pairs
            - a whole message
            or a list of them, where a first match will be picked"""

        return {"customer_name": [self.from_entity(entity="PERSON",
                                          intent="self_intro"),
                         self.from_text()],
                "blend": [self.from_entity(entity="blend"),
                          self.from_text()],
                "num_sugar": [self.from_entity(entity="num_sugar"),
                        self.from_text()],
                "num_cream": [self.from_entity(entity="num_cream"),
                self.from_text()]}

    
    @staticmethod
    def is_int(string: Text) -> bool:
        """Check if a string is an integer"""

        try:
            int(string)
            return True
        except ValueError:
            return False

    def validate_num_sugar(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> Dict[Text, Any]:
        """Validate num_sugar value."""

        if self.is_int(value) and int(value) > 0:
            return {"num_sugar": value}
        else:
            dispatcher.utter_template("utter_wrong_num_input", tracker)
            # validation failed, set slot to None
            return {"num_sugar": None}

    def validate_num_cream(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> Dict[Text, Any]:
        """Validate num_cream value."""

        if self.is_int(value) and int(value) > 0:
            return {"num_cream": value}
        else:
            dispatcher.utter_template("utter_wrong_num_input", tracker)
            # validation failed, set slot to None
            return {"num_cream": None}

As you could see on Rasa X, both sugar and cream slots are populated, yet it came back indicating one of the slots is “none”.