Utter_action feature

Hi all,
I have an advice/question regarding rasa_sdk. Like we have utter_template to call template from domain.yml in custom_action. Something like that do we have utter_action which is able to call actions from domain.yml file. I think it will be better than utter_template.
@juste_petr @souvikg10 @akelad @Ghostvv @tmbo

So you are saying that you don’t want to use that rasa_core_sdk feature of calling a custom action and instead want to call from domain.yml file. Well earlier you can call that for eg: if you have a custom action in actions.py file named as action_emotion, so you could add this function in domain.yml

Actions.action_emotion under the actions tag. But this method is deprecated now!. Templates are just some default answers the bot can answer but custom action is really great as you can output any control or output type to your client. This is why they are both seperate.

No, I am saying that we can call utter_action in custom_action like we call utter_template in our custom_action code by dispatcher.utter_template(“template_name”) so we don’t have to call utter_template (here template called from domain.yml -->>template section) same for action we can call utter_action from (domain.yml -->> action section)

BTW

This is not deprecated you can call from there too.

oh so you are saying that you want to call another action within an action? right?

Yeah

that’s a good idea! :slight_smile:

The Rasa way to do is to add your consecutive actions in stories.md. That way, your actions will be predicted one after another.

However, if you are sure that you definitely want to trigger another action after your current action, you can use the Follow Up Action event. Return this event from your current action so that Rasa triggers your next action.

@abhishakskilrock Just thinking intuitively, you can just call the run() function of whichever action class you want to execute from inside of another action(If both the actions are defined in the same file).

Shouldn’t this work? I might be wrong.

Let me know if it works.

1 Like

@aj_loki calling run(...) method should work

@aj_loki @Ghostvv Can you explain it a little brief, I didn’t get your approach it will be helpful if you can give me an example.

in your custom action call YourOtherCustomAction().run(dispatcher, tracker, domain)

It worked Thanx @Ghostvv but I have to use custom_action in FormAction so I thought to monkey patching in FormAction for custom_action rather than utter_ask_"__" but this run() method will not work on customizing FormAction. Is there any method so that I can call custom_action in FormAction?

Why it will not work in FormAction?

because it will call action from domain.yml with action name utter_ask_'intent-name' rasa_core_sdk/forms.py at 619d73883e0662fd9b8270b8b1424adb0a7be463 · RasaHQ/rasa_core_sdk · GitHub

you need to override this method to call appropriate run() method of you custom action