I’m new with Rasa and I am wondering if there’s a possibility of creating a custom action that can influence (or divert) a story.
Here is what I’m trying to do. I have two stories, story1 and story2, on story 2 I want to check if the user has already gone through story1, if not, the user is notified and the remaining steps on story2 are not executed. Is that possible?
Sadly, there is no direct way to know whether or not the user “went through” a story.
What you can do is execute a custom action at the end of story, which will set a slot. And it is that slot that will show whether or not that story happened.
In story2, you can use slot_was_set to branch off to different paths.
Chris,
Thanks for you reply. I guess I didn’t formulate my question precisely. What I want to do is to implement a custom action that can divert the conversation towards another intent. Take as an example the foloowing story:
As you can see, after the intent “tell_dirty_joke”, we trigger the custom action “action_custom_can_tell_dirty_joke” that should check (based on some algorithm) weather the bot should tell a joke or not, if the algorithm on the custom action rules the user can’t get a dirty joke, the bot will not execute “utter_dirty_joke1” and “utter_dirty_joke2”, but send a message, he can’t tell the joke now and say goodbye.
Obviously, this is just a example, but it serves to illustrate the general use case we have.
I understand that we can have the action to fill a slot, and use for that, but in our use case we may have hundreds os stories like that that need verification before executed, so that is why using slots and alternative paths seems too overkill, also given all the possible paths a user take in a conversation. So I am wondering if there’s something we can do to enhance this.
I wrote a custom action, but the custom action does not prevent the story to progress. And that is precisely the point. Obviously, since I’m working with rasa only for the last few months, I may not be seeing a solution yet.
Also, just to give you a little more context about my project, I am creating an chatbot authoring tool, based on Rasa (at least for now) So I am creating a solution that I can generalize and not rely on one-offs. The purpose of the tool is to allow users (with no knowledge of NLU) to create a bot using graph based interface. Hence, the need for generalization.