rasa_sdk/forms.py
def extract_requested_slot(
        self,
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        slot_to_fill: Any,
        domain: "DomainDict",
    ) -> Dict[Text, Any]:
        """Extract the value of requested slot from a user input
        else return None
        """
        logger.debug(f"Trying to extract requested slot '{slot_to_fill}' ...")

        # get mapping for requested slot
        requested_slot_mappings = self.get_mappings_for_slot(slot_to_fill)

        for requested_slot_mapping in requested_slot_mappings:
            logger.debug(f"Got mapping '{requested_slot_mapping}'")

            if self.intent_is_desired(requested_slot_mapping, tracker):
                mapping_type = requested_slot_mapping["type"]

                if mapping_type == "from_entity":
                    entity_type = requested_slot_mapping.get("entity")
                    value = (
                        self.get_entity_value(
                            entity_type,
                            tracker,
                            requested_slot_mapping.get("role"),
                            requested_slot_mapping.get("group"),
                        )
                        if entity_type
                        else None
                    )
                elif mapping_type == "from_intent":
                    value = requested_slot_mapping.get("value")
                elif mapping_type == "from_trigger_intent":
                    # from_trigger_intent is only used on form activation
                    continue
                elif mapping_type == "from_text":
                    value = tracker.latest_message.get("text")
                else:
                    raise ValueError("Provided slot mapping type is not supported")

                if value is not None:
                    logger.debug(
                        f"Successfully extracted '{value}' for requested slot '{slot_to_fill}'"
                    )
                    return {slot_to_fill: value}

        logger.debug(f"Failed to extract requested slot '{slot_to_fill}'")
        return {}
Extract the value of requested slot from a user input
        else return None
        
Extract the value of requested slot from a user input
else return None
Extract the value of requested slot from a user input else return None
def extract_requested_slot(
        self,
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        slot_to_fill: Any,
        domain: "DomainDict",
    ) -> Dict[Text, Any]:
        logger.debug(f"Trying to extract requested slot '{slot_to_fill}' ...")
        requested_slot_mappings = self.get_mappings_for_slot(slot_to_fill)
        for requested_slot_mapping in requested_slot_mappings:
            logger.debug(f"Got mapping '{requested_slot_mapping}'")
            if self.intent_is_desired(requested_slot_mapping, tracker):
                mapping_type = requested_slot_mapping["type"]
                if mapping_type == "from_entity":
                    entity_type = requested_slot_mapping.get("entity")
                    value = (
                        self.get_entity_value(
                            entity_type,
                            tracker,
                            requested_slot_mapping.get("role"),
                            requested_slot_mapping.get("group"),
                        )
                        if entity_type
                        else None
                    )
                elif mapping_type == "from_intent":
                    value = requested_slot_mapping.get("value")
                elif mapping_type == "from_trigger_intent":
                    continue
                elif mapping_type == "from_text":
                    value = tracker.latest_message.get("text")
                else:
                    raise ValueError("Provided slot mapping type is not supported")
                if value is not None:
                    logger.debug(
                        f"Successfully extracted '{value}' for requested slot '{slot_to_fill}'"
                    )
                    return {slot_to_fill: value}
        logger.debug(f"Failed to extract requested slot '{slot_to_fill}'")
        return {}
def extract_requested_slot ( self , dispatcher : "CollectingDispatcher" , tracker : "Tracker" , slot_to_fill : Any , domain : "DomainDict" , ) -> Dict [ Text , Any ] : logger . debug ( f"Trying to extract requested slot '{slot_to_fill}' ..." ) requested_slot_mappings = self . get_mappings_for_slot ( slot_to_fill ) for requested_slot_mapping in requested_slot_mappings : logger . debug ( f"Got mapping '{requested_slot_mapping}'" ) if self . intent_is_desired ( requested_slot_mapping , tracker ) : mapping_type = requested_slot_mapping [ "type" ] if mapping_type == "from_entity" : entity_type = requested_slot_mapping . get ( "entity" ) value = ( self . get_entity_value ( entity_type , tracker , requested_slot_mapping . get ( "role" ) , requested_slot_mapping . get ( "group" ) , ) if entity_type else None ) elif mapping_type == "from_intent" : value = requested_slot_mapping . get ( "value" ) elif mapping_type == "from_trigger_intent" : continue elif mapping_type == "from_text" : value = tracker . latest_message . get ( "text" ) else : raise ValueError ( "Provided slot mapping type is not supported" ) if value is not None : logger . debug ( f"Successfully extracted '{value}' for requested slot '{slot_to_fill}'" ) return { slot_to_fill : value } logger . debug ( f"Failed to extract requested slot '{slot_to_fill}'" ) return { }
Extract the value of requested slot from a user input
else return None
Extract the value of requested slot from a user input else return None
"""Extract the value of requested slot from a user input
        else return None
        """ # get mapping for requested slot # from_trigger_intent is only used on form activation
self
dispatcher
"CollectingDispatcher"
tracker
"Tracker"
slot_to_fill
Any
domain
"DomainDict"