Mohit
Mohit

Reputation: 1063

Rasa Core: utter_template() missing 1 required positional argument: 'tracker'

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.

Upvotes: 0

Views: 2181

Answers (2)

Jonathan Guymont
Jonathan Guymont

Reputation: 497

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.

Upvotes: 2

Mohit
Mohit

Reputation: 1063

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

Upvotes: 0

Related Questions