How to make a random pre-defined story run

Hello everyone, I’am very new with rasa, this is my second week using it. I’m trying to make an interviewer bot for a personal project. I have defined 5 different stories that have almost the same content, except for some responses and intents in the middle of the story. What I would like to achieve is to have a random story of the 5 defined stories to run every time time the user inputs the first intent (which is the same for the 5 stories) If you see any solution that could help me hit me up I’d me more than glad to hear it :slight_smile:

To randomly select one of the 5 stories to run every time the user inputs the first intent, you can use the Rasa Core’s random policy. You can define each story as a separate path and use the RandomPolicy to select a random path to follow.

Best Regard, Potts56

1 Like

Thanks a lot for your reply, I will look it up and try it out!

Hello again, hope you re doing great!

I tried to introduce RandomPolicy in my config.yml just to try it out but Rasa doesn’t seem to recognize it.

- name: MemoizationPolicy
- name: TEDPolicy
  max_history: 5
  epochs: 10
- name: RandomPolicy
  priority: 1

I get this error when I try to train my model

InvalidConfigException: Can't load class for name 'RandomPolicy'. Please make sure to provide a valid name or module path and to register it using the '@DefaultV1Recipe.register' decorator.

I also can’t find it anywhere in the rasa open source documentation. Could you please provide me with a link that introduces an example of usage of the Random policy? that would be great!

I believe there is no such policy as RandomPolicy in Rasa Open Source.

Also, you cannot expect a Rasa model to follow a certain story right after the first utterance – every next action depends on the previous actions.

If it’s possible, squash all your stories in one so that you can provide multiple utterances for the intents for which the stories previously differed, then remove TEDPolicy from the config.

I have made another thread where I approached the issue with another method as you suggested @sanjaradylov , please take a look