Error: An action must implement its run method

Hello together,

i want to program a form where it shows me links of a onlinecourse and needed therefore a custom action. It works until the action shall start. It recognices my input with the course as entity (I can see this through a utterance with the course.

But then it doesn’t work to send me back the easy text message at the end of the actions. Anyone ideas what the problem is?

Greetings Resand

Error Code from the action server:

Exception occurred while handling uri: ‘http://localhost:5055/webhook’ Traceback (most recent call last): File “c:\python37\lib\site-packages\sanic\app.py”, line 976, in handle_request response = await response File “c:\python37\lib\site-packages\rasa_sdk\endpoint.py”, line 102, in webhook result = await executor.run(action_call) File “c:\python37\lib\site-packages\rasa_sdk\executor.py”, line 387, in run events = await action(dispatcher, tracker, domain) File “c:\python37\lib\site-packages\rasa_sdk\interfaces.py”, line 254, in run raise NotImplementedError(“An action must implement its run method”) NotImplementedError: An action must implement its run method

Action Code

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker

from rasa_sdk.executor import CollectingDispatcher

from rasa_sdk.events import SlotSet

from rasa_sdk.forms import FormAction

class ActionCourseSearchCustom(Action):

def name(self) -> Text:

    return "course_form"

@staticmethod

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

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

    return ["course"]

"""def slot_mappings(self):

    return {"course": self.from_entity(entity="meetinglink",

                                           intent=["inform",

                                                    "search_course"])}"""

@staticmethod

def course_db():

    # type: () -> List[Text]

    """Database of supported cuisines"""

    return ["KPPP",

            "chinese",

            "french",

            "greek",

            "indian",

            "italian",

            "mexican"]        

def submit(self,

           dispatcher: CollectingDispatcher,

           tracker: Tracker,

           domain: Dict[Text, Any]) -> List[Dict]:

    """Define what the form has to do after all required slots are filled"""

    # utter submit template

    #dispatcher.utter_template('utter_submit', tracker)

    #return []

    dispatcher.utter_message(

        text="Here's the link to your lecture")

    return []

@Resand There is nothing as submit method in Action
run method is associated with Action
submit method is associated when using FormAction

Instead of

class ActionCourseSearchCustom(Action):

change to

class ActionCourseSearchCustom(FormAction):

For more detail refer -> https://blog.rasa.com/building-contextual-assistants-with-rasa-formaction

I would recommend class name to start as FormActionCourseSearch for form action. That won’t confuse between actions. Hope, it Helps!

1 Like

Worked thanks!