Unable to override action_restart"

Hello friends, I am trying to override the run method of custom action_restart to add my own functionalities to the existing one. I followed the steps mentioned in rasa docs for writing custom action restart.

My code looks like this:

class ActionReboot(Action):

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

  def run(self, dispatcher, tracker, domain):
      print("veda")
      output_json = {"message": "Restarting"}
      .......my functionality......
      dispatcher.utter_message(text=json.dumps(output_json))
      return [Restarted()]

I also put action_restart in domain.yml file.

After all these, when I send /restart message, This custom action is not getting triggered. can someone help me with this please?

Hi @meet4444,

Have you retrained the model? From the docs (Default Actions):

CAUTION
After adding this action to your domain file, re-train your model with rasa train --force. Otherwise Rasa won’t know you’ve changed anything and may skip re-training your dialogue model.

Apart from that, I’m not entirely sure, but a few thoughts:

  • Rename ActionReboot to `ActionRestart
  • def run should be async def run

Thank you for the response Etienne. This solution worked for me.

I already had retrained the model but did not put an async before run so I think that created the issue.

I thank you once again for the help.