(Kindly Reply) Rasa Custom Slot not working

I have set up a rasa bot (v. 1.10.17) for an online shop but I keep getting the error that slots are not extracted despite having a slot custom mapping in my actions.py. I have searched for similar issue on this forum and applied their solution but still I still have the “slot not extracted error”. My actions.py file:

class ActionFormInfo(FormAction):

    def name(self) -> Text:

        """Unique identifier of the form"""

        return "form_filling"

    @staticmethod

    def required_slots(tracker: Tracker) -> List[Text]:

        """A list of required slots that the form has to fill"""

        if tracker.get_slot('PICKUP') == 'YES':

            # if service contains . display a 

            # form for maintenace/purchase

            if  "." not in tracker.get_slot('SERVICE'):

                return ["KG", "FULLNAME", "PHONE", "PICKUP", "ADDRESS"]

            else:

                return ["FULLNAME", "PHONE", "PICKUP", "ADDRESS"]

        else:

            if "." not in tracker.get_slot('SERVICE'):

                return ["KG", "FULLNAME", "PHONE", "PICKUP"]

            else:

                return ["FULLNAME", "PHONE", "PICKUP"]

    ################################# form validation section ##############################

    #######################################################################################

    ######################################################################################

    ########################## validate input for cylinder kg ###########################

    @staticmethod

    def kg_db() -> List[Text]:

        return [

            1,2,3,5,6,10, 12.5,15, 20, 50

        ]

    def validate_KG(

            self,

            value: Text,

            dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any],

    ) -> Dict[Text, Any]:

        """Validate cylinder Kg value."""

        text_strip = value.strip()

        text_to_num = int(text_strip)

        if text_to_num in self.kg_db():

            return {"KG": value}

        else:

            print(value)

            dispatcher.utter_message(template="utter_wrong_kg_value")

            return {"KG": None}

        

    ########################## validate input for phone number ##############################

    def validate_PHONE(

            self,

            value: Text,

            dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any],

    ) -> Dict[Text, Any]:

        """Validate Phone number value."""

        digit_count = len(value)

        digit_strip = value.strip()

        digit_to_num_check = int(digit_strip)

        if digit_count == 11 and digit_to_num_check:

            return {"PHONE": value}

        else:

            print(value)

            dispatcher.utter_message(template="utter_wrong_phone_value")

            return {"PHONE": None}

            

    ########################## validate input of pickup form field ##############################

    @staticmethod

    def pickup_db() -> List[Text]:

        """Database of supported pickup response"""

        return [

            "YES",

            "NO"

        ]

    def validate_PICKUP(

            self,

            value: Text,

            dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any],

    ) -> Dict[Text, Any]:

        value_stripe = value.strip()

        value_upper = value_stripe.upper()

        

        if value_upper in self.pickup_db():

            return {"PICKUP": value_upper}

        else:

            dispatcher.utter_message(template="utter_wrong_pickup_value")

            return {"PICKUP": None}

    ################################# Slot mapping section #################################

    #######################################################################################

    ######################################################################################

    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:

        return {

            "kg": [self.from_entity(entity="KG"), self.from_text()],

            "fullname": self.from_text(intent=None),

            "phonenumber": self.from_text(intent=None),

            "staffpick": self.from_text(intent=None),

            "pickupaddress": self.from_text(intent=None),

            "total": self.from_text(intent=None),

            "service" : [

                self.from_entity(

                    entity="SERVICE", intent=["cylinder_refill", "cylinder_purchase",

                    "cylinder_painting", "maintenance_table_gas", "maintenance_single_knub", "maintenance_double_knub", 

                    "maintenance_camping_burner", "maintenance_top_ignation", "maintenance_cooker_ignation", 

                    "maintenance_top_stand", "buy_camping_burner", "buy_metal_burner", "buy_aluminum_burner", 

                    "buy_burner_control", "buy_cap_burner", "buy_std_reg", "buy_ind_reg", "buy_cap_reg", "buy_hose"]

                ),

            ],

        }

    ################################# form submit section #################################

    #######################################################################################

    ######################################################################################

    def submit(

            self,

            dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any],

    ) -> List[Dict]:

        ########## get record from SERVICE slot ##########

        distance = 0

        if tracker.get_slot("PICKUP") == "YES":

            ########## get the the pickup address ##########

            pickup_address = tracker.get_slot('ADDRESS')

            ########## call function to calculate km ##########

            distance = calculate_km('pickup_address')

            ########## save cal KM to slot ##########

            SlotSet("KILOMETER", distance)

        ########## calculate delivery fee section ##########

        ####################################################

        ########## remove trailing space from cal km if any ##########

        distance = distance.strip()

        transport_fee = float(distance) * (50*2)

        ########## get service fee from api ##########

        product_fee =3000

        total = int(transport_fee ) + product_fee

        ########## save fee to slot depending on the PICKUP ##########

        if tracker.get_slot('PICKUP') == "Yes":

            SlotSet('FEE', total)

        else:

            SlotSet('FEE', product_fee)

        ########## display submit button based on PICKUP ##########

        Guage = tracker.get_slot('KG')

        if tracker.get_slot('PICKUP') == 'YES':

            if "." in tracker.get_slot('SERVICE'):

                dispatcher.utter_message(

                    template="utter_submit_utility",

                    fullname=tracker.get_slot('FULLNAME'),

                    phonenumber=tracker.get_slot('PHONE'),

                    staffpick=tracker.get_slot('PICKUP'),

                    pickupaddress=tracker.get_slot('ADDRESS'),

                    total=tracker.get_slot('FEE'), 

                    service = tracker.get_slot('SERVICE'))

            else:

                dispatcher.utter_message(

                    template="utter_submit", kg=Guage,

                    fullname=tracker.get_slot('FULLNAME'),

                    phonenumber=tracker.get_slot('PHONE'),

                    staffpick=tracker.get_slot('PICKUP'),

                    pickupaddress=tracker.get_slot('ADDRESS'),

                    total=tracker.get_slot('FEE'), 

                    service = tracker.get_slot('SERVICE'))

        else:

            if "." in tracker.get_slot('SERVICE'):

                dispatcher.utter_message(

                    template="utter_submit_reponse_no_utility",

                    fullname=tracker.get_slot('FULLNAME'),

                    phonenumber=tracker.get_slot('PHONE'),

                    staffpick=tracker.get_slot('PICKUP'),

                    total=tracker.get_slot('FEE'),

                    service = tracker.get_slot('SERVICE')

                )

            else:

                dispatcher.utter_message(

                    template="utter_submit_reponse_no", kg=Guage,

                    fullname=tracker.get_slot('FULLNAME'),

                    phonenumber=tracker.get_slot('PHONE'),

                    staffpick=tracker.get_slot('PICKUP'),

                    total=tracker.get_slot('FEE'),

                    service = tracker.get_slot('SERVICE')

                )

        return []

The story, nlu and domain files are available at: GitHub - edmundrotimi/rasabot.

I am not asking for any code snippet, all I am kindly asking for is a pointer to what I am currently doing wrong that is causing the slot extraction error. Thanks in earnest expectation.

Please use markdown quotes to make your code examples readable and thanks for sharing your git repo.

Your nlu.md has no entity extraction examples for DIET to train on.

This is my account number [1234567891](account_number)

You need to add examples for all of your entities.

1 Like