Creating Custom Policy

Hello,

Is there any posibility to implement a custom policy. At the Documentation it looks like i could implement my own policy and import this at config.yml.

I looked at the Rasa-Source code and it looks like the policys must registered at rasa/core/policies/registry.py is this correct? Actually I implement my custom policy as a extension directly in Rasa-Core, but it feels wrong. I hope there’s a better solution to this.

The reason to do this is a research within my master thesis. I am looking for a framework where I could implement a Reainforcement Learning policy and compare it with already used policys, like the standard kerasPolicy.

I would very much appreciate your help.

Dominic Karnehm

Hello @karnehm,

Yes, you can implement a custom policy. Just write your own class that inherits from rasa.core.policies.Policy and add the policy to config.yml as described in the docs. The policy’s name in config.yml should simply be the path to your policy class.

You don’t have to modify rasa/core/policies/registry.py or to write anything else directly in Rasa-Core.

Does this answer your question?

3 Likes

Thank you @chkoss,

now it worked. I used an incorrect policy Path and forgot to implement __init__.py .

Thank you for your help.

2 Likes

@chkoss Thanks for this. I am trying to do this with rasa x in production using Docker. Where do I need to mount the file where my policy resides for it to work correctly?

Did you manage to solve this?