How exactly do stories work?

I had read the documentation on Stories and looked up tutorials but I could not find an explanation. I have no idea what the expected behaviour of stories is supposed to be.

I have these 4 stories and 1 checkpoint:

- story: provide recipe path
  steps:
  - checkpoint: provide_recipe
  - action: utter_provide_recipe

- story: happy neutral path want recipe
  steps:
  - intent: greet
  - action: utter_greet
  - action: utter_greet_follow_up
  - intent: mood_great_or_neutral
  - action: utter_happy
  - action: utter_want_recipe
  - intent: affirm
  - slot_was_set:
    - want_recipe: true
  - checkpoint: provide_recipe


- story: happy neutral path dont want recipe
  steps:
  - intent: greet
  - action: utter_greet
  - action: utter_greet_follow_up
  - intent: mood_great_or_neutral
  - action: utter_happy
  - action: utter_want_recipe
  - intent: deny
  - slot_was_set:
    - want_recipe: false

- story: sad path want recipe
  steps:
  - intent: greet
  - action: utter_greet
  - action: utter_greet_follow_up
  - intent: mood_unhappy
  - action: utter_sympathy
  - action: utter_want_recipe
  - intent: affirm
  - slot_was_set:
    - want_recipe: true
  - checkpoint: provide_recipe

- story: sad path dont want recipe
  steps:
  - intent: greet
  - action: utter_greet
  - action: utter_greet_follow_up
  - intent: mood_unhappy
  - action: utter_sympathy
  - action: utter_want_recipe
  - intent: deny
  - slot_was_set:
    - want_recipe: false

I had assumed that stories strictly control the flow of the conversation, until I came across these two posts Cant we skip and jump to some intent within a story and Story Flow , and they seem to imply that conversation is not meant to strictly follow the story paths. However, as mentioned at the beginning of the post, I could not find any documentation explaining the expected behaviour of stories.

In my project, in any story path, no matter which step of the story I’m at, if I type “yes” or any other affirmative word, the chatbot replies with utter_want_recipe.

Similarly, if I’m on “sad path want recipe” and type “im fine”, the chatbot responds with utter_happy; if I’m on “happy neutral path want recipe” and type “sad”,the chatbot responds with utter_sympathy.

My stories appear to be acting like rules instead of stories. Am I doing something wrong, or is this supposed to happen?

Hi, what do you mean by change? Do I rename the intents and utterances to something else? How do I know if my chatbot is trained on mood bot?

I’m afraid I don’t understand what you mean by change. Are you asking me to make changes to the text in intents like mood_great_or_neutral and mood_unhappy? I have done that for every intent in nlu.yml. I also rewrote the text for every utter action. My chatbot has been re-trained multiple times but the chatbot still acts like this.

I have changed the category, thanks.

The story works as intended if I use inputs that follow the story’s flow.

In domain.yml, I have these:

config:
  store_entities_as_slots: true
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- greet:
    use_entities: true
- goodbye:
    use_entities: true
- affirm:
    use_entities: true
- deny:
    use_entities: true
- mood_great_or_neutral:
    use_entities: true
- mood_unhappy:
    use_entities: true
entities: []
slots:
  want_recipe:
    type: rasa.shared.core.slots.BooleanSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true

And without showing the text for every utterance, I have these for actions:

actions:
- action_check_want_recipe
- utter_goodbye
- utter_greet
- utter_greet_follow_up
- utter_happy
- utter_provide_recipe
- utter_want_recipe
- utter_fallback
- utter_default
forms: {}
e2e_actions: []

I have also checked the stories against test_stories.yml and they pass. I’m not sure how I should be changing the story, as I don’t fully understand how stories work, and I don’t know what the expected outcome of stories is supposed to be.

responses:
  utter_greet:
  - text: Hey!
  - text: Hello!
  - text: Hi there!
  utter_greet_follow_up:
  - text: How are you?
  - text: How are you doing?
  - text: How are you today?
  utter_sympathy:
  - text: I'm sorry to hear that, I hope your day gets better.
  utter_happy:
  - text: I'm glad you're doing fine!
  - text: That's great!
  utter_goodbye:
  - text: Bye
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
  utter_want_recipe:
  - text: Would you like a recipe?
  utter_ask_meal:
  - text: What did you have for your meal today?
  utter_ask_if_liked_meal:
  - text: Did you enjoy it?
  utter_nutrition_fact:
  - text: Here's today's nutritional fact for the day!
  utter_provide_recipe:
  - text: Recipe placeholder
  utter_fallback:
  - text: Sorry, I haven't learnt how to understand that.
  utter_ask_rephrase:
  - text: Sorry, I didn't understand that. Could you rephrase?
  utter_default:
  - text: Sorry, I haven't learnt how to handle that.

Thanks for the help. I had read the documentation and looked up tutorials multiple times but did not understand it, until I came across this post Does rasa strictly follow stories - #3 by souvikg10

If my understanding is correct, stories are just training data; stories are used to train the chatbot to make responses according to the user’s intent, according to the specific context. They are not used to strictly define what the conversation is supposed to be.

So the problem I am facing with my current chatbot is that my chatbot is trained too well on intent-response groups that were repeated multiple times, like this:

  - intent: greet
  - action: utter_greet
  - action: utter_greet_follow_up

intent greet with utter_greet is trained 4 times in stories.md, and more with data augmentation

  - intent: mood_great_or_neutral
  - action: utter_happy

intent mood_great_or_neutral with utter_happy is trained 2 times in stories.md, and more with data augmentation

  - intent: mood_unhappy
  - action: utter_sympathy

intent mood_unhappy with utter_sympathy is trained 2 times in stories.md, and more with data augmentation

  - intent: affirm
  - slot_was_set:
    - want_recipe: true
  - checkpoint: provide_recipe

intent affirrm with slot want_recipe and checkpoint provide_recipe is trained 2 times in stories.md, and more with data augmentation

  - intent: deny
  - slot_was_set:
    - want_recipe: false

And lastly, intent deny with slot want_recipe is trained 2 times in stories.md, and more with data augmentation.

Is my understanding correct?

Hi, I appreciate the help but the above suggestion did not solve my query. I had read the documentation many times and was seeking a detailed explanation that the documentation did not provide, so asking me to read the documentation was not helpful. I followed a free Udemy course by Rasa and finally understood how stories worked.

@lamxw2 Thanks for the feedback, Its good you solved your query, I will withdraw my post (8 posts) , so other not get confused, Well I even tried to explained you and I encourage you to read it. Please follow other courses too :slight_smile: