The documentation is not clear on how to combine stories and rules when writing training data for an intent that involves form filling. I wrote rules for filling forms that look like this:
- story: look up mail server
steps:
- intent: lookup_mail_server
- action: action_interject
- action: email_form
- active_loop: email_form
- active_loop: null
- action: action_fetch_mail_server
- action: action_follow_up
But when I train the model I get an ERROR saying ācontradicting rules and storiesā.
My understanding is that you can have a story without a rule but you cant have a rule without a story or the action prediction wont work. Is that correct or can someone clarify the dependency relationship between the two?
Can someone please provide a full example of how to write a story and rule for an intent that involves form filling? Or how to know when only a story OR a rule is necessary?
Hey @tatianaf your rules donāt need stories to function, you can have a bot that consists only of rules if you wanted to. You can find a description on when to use rules vs stories in this docs page.
Your story is contradicting in this case in multiple places (it would be contradicting even if you were using only stories, and not rules):
- story: look up mail server
steps:
- intent: lookup_mail_server
- action: action_interject
Iāve removed the rules because I found the story format to be more straight forward and there are no conflicts now. Ive read the docs multiple times but I still dont think thereās a clear sense given for when rules are actually necessary instead of just using storiesā¦ Maybe you guys could do a better job of giving more in-depth examples or tutorials that better illustrate scenarios where rules should be used or stories and rules should be used together. It seems to be more āintuitiveā than logical so longer examples/tutorial would do a better job of offering that intuition.
Iām not sure I fully understand the confusion around the rule format - the format is almost identical to stories, with the exception of the condition. Could you clarify which part is confusing?
As for when to use rules vs stories, thereās a list of when to use rules in the documentation page I linked:
it will always work exactly as specified, regardless of how many times the user says āgreetā over and over again. If you only have a story for this, itās not guaranteed that that will work every time.
Thanks for your answer. Ive read the docs, including the excerpt you shared and when I read it, it wasnt clear why you would rules for any of those when you could also use stories- the advantage was not clear. Although the last sentence of your answer does offer more clarification āit will always work exactly as specified, regardless of how many times the user says āgreetā over and over again. If you only have a story for this, itās not guaranteed that that will work every time.ā
So I guess stories can replace all rules but not all rules can replace stories because sometimes stories can be used to capture varied behavior where as rules can only capture consistent behavior. Stories are training data used for the prediction model but rules are hardcoded conditions not training data?
Sorry if it seems Im being overly detailed here but weāve had a lot of issues with our use of forms and writing stories for forms in Rasa 1 and the main reason for us migrating to Rasa 2 immediately is to address those issues. The docs makes it seem simple but in actual production use its incredibly nuanced and easy to get wrong/unexpected behavior.
@tatianaf
Your absolutely right. I wonder why donāt these guys develop a friendly documentation.
@Rasa I have watched many Tutorials in Youtube, which is 1.8, And you guys released 2.0 with major updated and not yet released its tutorials, the documentation which is available in your website are not friendly.
oops, I thought I had answered this a while ago, but yes @tatianaf that summary sums it up.
@susajsnair weāre happy to address any specific feedback you have on the documentation if you share it. There are plenty of example bots available which you can use as a reference instead of some of the videos for now:
@akelad i actually mean, if someone comes and try to understand newly, will try to work with RASA 2.x and there is no more proper tutorials available, The docs which are available in website is good for those who has already part of it, not for newbies.
My name is Vincent. Iām part of the devrel team and Iāll be making some extra content on this topic. Iāve already made a video on the idea behind the RulePolcy from the ML perspective but Iāll work on making a proper blog post/guide on rules too. Iāll also create a git repo that contains a full example of how rules interact with forms.
Iāll use this thread as inspiration, but if there are other specific pain points youāre welcome to mention them in this thread.