# How does rasa connect the graph on the back to know what to do next?

**URL:** <https://forum.rasa.com/t/how-does-rasa-connect-the-graph-on-the-back-to-know-what-to-do-next/2720>\
**Category:** Rasa Open Source\
**Created:** [November 16, 2018, 6:33am UTC](https://forum.rasa.com/t/how-does-rasa-connect-the-graph-on-the-back-to-know-what-to-do-next/2720 "2018-11-16T06:33:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sailaja](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sailaja](https://forum.rasa.com/u/sailaja)\
**Post date:** [November 16, 2018, 6:33am UTC](https://forum.rasa.com/t/how-does-rasa-connect-the-graph-on-the-back-to-know-what-to-do-next/2720/1 "2018-11-16T06:33:26Z")

</div>

I am having a difficult time understanding how rasa core interprets stories. Say I have the following:

```auto
Slot:
 name:
  type: text
 animal:
  type: categorical
  values:
  - dog
  - cat

```

How do I write my stories to handle the sad path for a categorical slot?

```auto
*greet
 - utter_greet
 - utter_please_give_name
*inform{"Name":"Name"}
 - utter_hello
 - utter_ask_animal
*inform{"Animal": "Dog"}
 - utter_hello_fido
 - action_restart

*greet
 - utter_greet
 - utter_please_give_name
*inform{"Name":"Name"}
 - utter_hello
 - utter_ask_animal
*inform{"Animal": "Cat"}
 - utter_hello_kitty
 - action_restart

*greet
 - utter_greet
 - utter_please_give_name
*inform{"Name": null}
  -utter_please_give_name

*greet 
 - utter_greet
 - utter_please_give_name
*inform{"Name": "Name"}
  -utter_ask_animal
*inform{"Animal": **"?????"** }
 - utter_please_tell_animal

```

Also if I give a partial story in stories.md, like below, how does rasa connect the graph on the back to know what to do next? Does it read each story as an independent flow?

```auto
*greet
 - utter_greet
 - utter_please_give_name
*inform{"Name": null}
  -utter_please_give_name

```

Thank you,S Sailaja

---

<div class="post-metadata">

**Author:** ![MetcalfeTom](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/metcalfetom/32/1422_2.png) [@MetcalfeTom](https://forum.rasa.com/u/MetcalfeTom)\
**Post date:** [November 29, 2018, 2:51pm UTC](https://forum.rasa.com/t/how-does-rasa-connect-the-graph-on-the-back-to-know-what-to-do-next/2720/2 "2018-11-29T14:51:45Z")

</div>

Hi @sailaja,

I sense a bit of confusion here. When there is `inform{"Animal": "Dog"}` present on the human side, it indicates that Rasa NLU extracts an entity `Dog` of type `Animal` from the user message, for instance in the message `I am a Dog with a keyboard`. If there is a slot with the same name as the entity type in your domain, the extracted entity fills the slot automatically.

Your sad path just looks like a user message without any entities:

```auto
*greet
 - utter_greet
 - utter_please_give_name
*inform
  -utter_please_give_name

```

As for the second part, that depends on your policy. By default, `MemoizationPolicy` will read each story independently up to `max_history` turns in the dialogue. If there is no story which exactly matches the situation at test time, `KerasPolicy` will try to predict the best response from a generalization of your training stories

Hope I’ve been helpful!

[More info on policies here](https://rasa.com/docs/core/policies/)
