[Discussion] Stories vs Rules

gives a great response to the question that prompted my question:

I’m just a bit confused as to when I absolutely NEED to use a story vs just using a rule. Most bots could just work on well set rules as well as the (great) nlu entity and intent detection pipelines of rasa?

I realize I’m coming off hard headed and am missing the whole point of rasa :slight_smile: I still did just wanted to start a new discussion to document these cases for me (as well as any future users!)!

If you can think up any (simple?) situations where only the stories functionalities would work, or you can think of stand-out cases where the power of having the stories functionality shines, please do add a comment!

Hi @ShubhVachher, generally speaking you will want to use stories for training the dialogue manager because it is machine learning based, making the model more robust to unseen paths. Only in specific cases where the bot’s response is always deterministic (e.g. a human handoff intent triggering a handoff action) is when rules should be used.

Thanks for your reply @b-quachtran! Right. But, lets say you had a bot that was Form Filling + Handling FAQs and Chitchat (as is the case with many (most?) current bots <- I may be very wrong.).

Form filling is rule based and FAQs as well as form early stopping in between can be handled using rules. In that case where would I put in a story, for my understanding?

Further, thinking “rule based” is easy for programmers, like me. How do I develop “trust” in a story based development approach? i.e, that the ML system would follow the path specified and wouldn’t drift off on its own based on biased pre-training data/ “less” NLU data. <- less being the operative word: very different in different situations.

For Form Filling & FAQ’s, rules will work but for context-dependent scenarios like answering FAQ’s inside a Form and then prompting if the user wants to continue, stories are required.

In this example, your FAQ’s will need to be defined as stories as well, since the response is no longer deterministic (Only the FAQ answer is provided outside of a form. When the user is inside a form, however, a second utterance needs to appear as well).

On story building, it’s important to have a well-defined test set and a sufficiently large number of training examples to gauge how the ML dialogue manager is performing. I would refer to our documentation on model testing for best practices there: Testing Your Assistant

For the example you provided, I believe, the supported way to solve it would be by splitting up form activation and submission.

By splitting up the activation and submission of the form, the rules will still apply if the user provides unexpected input or interrupts the form with chitchat.

So, the form begins, then you can do what you want in between while it is active (like answering questions, etc.) and at the end of the answering of each of your questions, the form would resume giving you the “second utterance”. Then you are again free to ask any question, interrupt the form running etc.

Yup. As is with any good ML pipeline, validation and testing is critical! Thanks for the insight and the link.

Maybe I reiterate again. Seems to me that at-least for bots that just fill forms and answer FAQs (still not sure on how many bots would fit snugly into this set, but my guess is most!), you wouldn’t need to rely on the ML pipeline for response selection (you still do need intent classification and entity recognition of course!).

So, I restate, is there any “context dependent” path in today’s use of NLP bots that stands out, to all reading this, as an exemplar of the use of stories for bot development?

So, the form begins, then you can do what you want in between while it is active (like answering questions, etc.) and at the end of the answering of each of your questions, the form would resume giving you the “second utterance”. Then you are again free to ask any question, interrupt the form running etc.

This won’t work because the second continuation utterance would appear regardless of whether the Form has been interrupted. Because this second utterance is context-dependent, stories are required to implement the scenario.

hm. I think I’m a bit confused about the “second utterance” bit. Could I bother you to give an example? Thanks!

What I mean is: Say we have a simple form that lets you store what your favorite number is… The conversation after implementing splitting up form activation and submission could look like:

Happy path:

user: “can i save my fav number?” (intent: inform_fav)

bot: “Please type out your fav number so I can save it”

user: “my fav number is 23” (intent: inform_fav)

bot: “Great. I’ve saved your favorite number as 23”

Handling FAQs:

user: “can i save my fav number?” (intent: inform_fav)

bot: “Please type out your fav number so I can save it”

user: “by when is this assignment due?”

bot: “This assignment’s deadline is the 31st”

bot: "Please type out your fav number so I can save it"

user: “and how will the assignment be graded?”

bot: “The grading policy is given in the course website.”

bot: "Please type out your fav number so I can save it"

user: “my fav number is 23” (intent: inform_fav; entity: fav_num; value: 23)

bot: “Great. I’ve saved your favorite number as 23”