0

I am using Rasa core v10.2, with custom actions, but getting utter_template() missing 1 required positional argument: 'tracker' error on the run function.

Custom action file: (actions.py)

from rasa_core.actions import Action
from rasa_core.events import SlotSet

class searchJob(Action):
    def name(self):
        return 'action_search'

    def run(self, dispatcher, tracker, domain):
        return [SlotSet("jobsname", "as_aggregate")]

domain.yml:

slots:
  jobsname:
    type: text

templates:
 utter_answer:
    - text: "The required jobs are {jobsname}"

Stories:

* search
  - action_search
  - utter_answer

The output is [{'recipient_id': 'default', 'text': 'The required jobs are None'}] which means the Slot it not set. Could the error message be the cause of it?

Thank you.

Mohit
  • 1,045
  • 4
  • 18
  • 45

2 Answers2

2

Are you sure you are looking at the right custom action? I had the same error message because in one of my custom action I was using dispatcher.utter_template() like this:

dispatcher.utter_template('utter_something')

and apparently tracker is now a required argument, i.e. I add tracker like this:

dispatcher.utter_template('utter_something', tracker)

and the error is gone.

PS: I know this should be a comment, but I am not allowed since my reputation is not high enough.

Jonathan Guymont
  • 497
  • 2
  • 11
0

So the issue seems to be the name of the custom action file, change it to anything else from 'actions' will do.

Mohit
  • 1,045
  • 4
  • 18
  • 45