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

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

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?

*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?

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

Thank you,S Sailaja

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:

*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