Rasa_sdk.endpoint - Failed to extract slot module with action leave_form

I am using FormAction for slot filling i am getting the error (my form name is leave_form) PLEASE HELP WITH THE ERROR

running the actions.py file by:

python -m rasa_core_sdk.endpoint --actions actions (no error in starting the api with endpoint)

trained both model at once by command “rasa train”, currently having models directory for model

running the model by command “rasa shell”

action.py snippet:

from typing import Any, Text, Dict, List, Optional, Union

from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.forms import FormAction

class LeaveForm(FormAction):

    def name(self) ->Text:
            return "leave_form"

    @staticmethod
    def required_slots(tracker:Tracker) -> List[Text]:
            return ['module','sub_function','question']

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

            return {
                    'module': self.from_entity(entity='module'),
                    'sub_function': self.from_entity(entity='sub_function'),
                    'question': self.from_entity(entity='question')

                    }


    @staticmethod
    def valid_modules() -> List[Text]:
            return ['attendance','leave','leave(policy change)',]

    def validate_module(
                    self,
                    value:Text,
                    dispatcher:CollectingDispatcher,
                    tracker:Tracker,
                    domain:Dict[Text,Any]
                    )-> Optional[Text]:

            if value.lower() in self.valid_modules():
                    #dispatcher.utter_template('utter_ask_module',tracker)
                    print('inside validating..')
                    return {'module':value}
            else:
                    dispatcher.utter_template('utter_wrong_module',tracker)
                    return {'module':None}

    @staticmethod
    def valid_sub_function()->List[Text]:
             return ['attendance history','attendance deletion']

def validate_sub_function( self, value:Text, dispatcher:CollectingDispatcher, tracker:Tracker, domain:Dict[Text,Any] ) -> Optional[Text]:

            if value.lower() in self.valid_sub_function():
                    #dispatcher.utter_template('utter_ask_sub_function',tracker)
                    return {'sub_function':value}
            else:
                    dispatcher.utter_template('utter_wrong_sub_function',tracker)
                    return {'sub_function':None}
    def question(
                    self,
                    value:Text,
                    dispatcher:CollectingDispatcher,
                    tracker:Tracker,
                    domain:Dict[Text,Any]
                    ) -> Optional[Text]:

            return {'question':value}

    def submit(self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) ->List[Dict]:
            dispatcher.utter_template("utter_submit",tracker)
            return []

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

stories:

happy path

  • greet
    • utter_greet
  • mood_great
    • utter_happy
  • request_leave
    • leave_form
    • form{“name”: “leave_form”}
    • form{“name”: null}
    • utter_slots_values

sad path 1

  • greet
    • utter_greet
  • mood_unhappy
    • utter_cheer_up
    • utter_did_that_help
  • affirm
    • utter_happy

sad path 2

  • greet
    • utter_greet
  • mood_unhappy
    • utter_cheer_up
    • utter_did_that_help
  • deny
    • utter_goodbye

say goodbye

  • goodbye
    • utter_goodbye

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

intents:

  • greet
  • goodbye
  • affirm
  • deny
  • mood_great
  • mood_unhappy
  • request_leave: use_entities: false

entities:

  • module
  • sub_function
  • question

slots: module: type: unfeaturized auto_fill: false sub_function: type: unfeaturized auto_fill: false question: type: unfeaturized auto_fill: false

templates: utter_greet: - text: “Hey! How are you?” utter_cheer_up: - text: “Here is something to cheer you up:” image: “https://i.imgur.com/nGF1K8f.jpg” utter_did_that_help: - text: “Did that help you?” utter_happy: - text: “Great carry on!” utter_goodbye: - text: “Bye” utter_ask_sub_function: - text: “Please provide the sub-function…” utter_ask_module: - text: “Please provide the module name…” utter_ask_question: - text: “Now Please enter the question” utter_submit: - text: “All Done…!!..” utter_wrong_module: - text: “Sorry I didnt understand please try again” utter_wrong_sub_function: - text: “Sorry I didnt get you please try again” utter_slots_values: - text: “I am going to answer on the following inputs provided by you: - module name: {module} - sub_function: {sub_function} - question: {question}” actions:

  • utter_slots_values
  • utter_greet
  • utter_cheer_up
  • utter_did_that_help
  • utter_happy
  • utter_goodbye

forms:

  • leave_form

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

nlu.md

intent:greet

  • hey
  • hello
  • hi
  • good morning
  • good evening
  • hey there

intent:request_leave

  • i want to check leave
  • need to check the leaves
  • take to leave
  • leaves
  • leave balance
  • leave
  • leave balances

intent:goodbye

  • bye
  • goodbye
  • see you around
  • see you later

intent:affirm

  • yes
  • indeed
  • of course
  • that sounds good
  • correct

intent:deny

  • no
  • never
  • I don’t think so
  • don’t like that
  • no way
  • not really

intent:mood_great

  • perfect
  • very good
  • great
  • amazing
  • wonderful
  • I am feeling very good
  • I am great
  • I’m good

intent:mood_unhappy

  • sad
  • very sad
  • unhappy
  • bad
  • very bad
  • awful
  • terrible
  • not very good
  • extremely sad
  • so sad

sorry, what is the actual error?

in nlu.md file i have marked some sentences under the intent like: specifying the test example i am using

intent:request_leave

  • i want to apply the leaves

in above case i am not using any entitiy against the module on this my form is getting activating form name : “request_form”

and now bot asks for the slots and the required slots are mentioned in requested_slot method

i have validate method also which is validating the user entry for the requested slot.

i am using rasa shell utility to test my bot input from me: i want to apply the leaves response from bot: please provide the module name here module is my slot after entering, no response from bot, ideally it should validate the input against the data mentioned in validate_slot_name method and if passed then should ask for the next module but in my case after entring the module name no response and error in actions.py server is “failed to extract the slot module with action leave form”

please help in the regards…

it means that your extraction logic is incorrect and slot cannot be extracted from provided information