예제 #1
0
파일: forms.py 프로젝트: yueyedeai/rasa
    def required_slots(self, domain: Domain) -> List[Text]:
        """A list of required slots that the form has to fill.

        Returns:
            A list of slot names.
        """
        return list(domain.slot_mapping_for_form(self.name()).keys())
예제 #2
0
파일: forms.py 프로젝트: yueyedeai/rasa
    def get_mappings_for_slot(self, slot_to_fill: Text,
                              domain: Domain) -> List[Dict[Text, Any]]:
        """Get mappings for requested slot.

        If None, map requested slot to an entity with the same name
        """

        requested_slot_mappings = self._to_list(
            domain.slot_mapping_for_form(self.name()).get(
                slot_to_fill, self.from_entity(slot_to_fill)))
        # check provided slot mappings
        for requested_slot_mapping in requested_slot_mappings:
            if (not isinstance(requested_slot_mapping, dict)
                    or requested_slot_mapping.get("type") is None):
                raise TypeError("Provided incompatible slot mapping")

        return requested_slot_mappings