Rasa Core - Understanding Stories

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 will rasa core know to connect that back into the conversation flow?

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

Thank you, any advice is appreciated.

with the sad path I guess you mean the user hasn’t provided an animal? then you would just write * inform without any entities. If you mean a value that isn’t a supported value for the categorical slot, then you could use a custom action to check whether the entity has one of the accepted values. If it does return a SlotSet event, otherwise ask for the animal again

As for connecting the stories to the conversation flow, as long as you’re not in the middle of a story, Core will be able to predict these partial stories fine. Data augmentation is performed during training which glues these stories together and allows Core to predict them correctly

@akelad @tmbo

Can I do it without using custom actions? I mean I just need to repeat the old question i.e., utter_ask_animal if it’s not one of the slot values?

You can also do it in your stories, if the user doesn’t provide an entity, utter something else