0

I'm trying to implement custom actions and have added action_get_answer to domain.yml.

actions:
 - utter_greet
 - utter_cheer_up
 - utter_did_that_help
 - utter_happy
 - utter_goodbye
 - actions.GetAnswer

Added the action in actions.py :

class GetAnswer(Action):

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


    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        dispatcher.utter_message("action_get_answer")

        return []

Ran the action server:

$ rasa run actions

Upon running rasa server :

$ rasa x

i get this error and GetAnswer is not triggered -

ERROR rasa.core.processor - Encountered an exception while running action 'action_get_answer'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.

How do I make this work?

Thanks

Alex Bravo
  • 1,601
  • 2
  • 24
  • 40
vivekanon
  • 1,813
  • 3
  • 22
  • 44

2 Answers2

1

I am also working on RASA X. I have created custom actions and it is successfully called. But first I want to know, does your stories.md file contain that action ? means when to call that action. Here I am giving what I have implemented :

In stories.md file :-

## story1
* play
  - action_ask_question

In domain.yml file :-

...
actions:
- action_ask_question
...

In action.py file :-

class ActionAskQuestion(Action):
     def name(self):
          return "action_ask_question"
     def run(self, dispatcher, tracker, domain):
          dispatcher.utter_message("Action called.")
          return []

If you have any question, comment it.

Rutvik
  • 51
  • 8
0

I also had this error while using custom actions in Rasa (not Rasa X). Error image

I sloved the problem by adding action endpoints to endpoints.yml file

action_endpoint:
 url: "http://localhost:5055/webhook"

run actions server using one command-line

rasa run actions

or (if you had not installed rasa)

python -m rasa_sdk --actions actions

and run rasa shell using another command-line (with endpoint configurations)

rasa shell --endpoints endpoints.yml