Reputation:
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, any advice is appreciated.
Upvotes: 2
Views: 602
Reputation: 29
If you want to handle all animals names so simply you can add more categories or make a custom action to fetch some api to call an animal name or something, Rasa is learning by examples anything not entered in data or domain will act as strange text.
Upvotes: 0
Reputation: 1910
To handle the sad path simply omit the slot annotation, e.g.:
## sad path
*greet
- utter_greet
- utter_please_give_name
*inform
-utter_please_give_name
Depending whether you use augmentation the single stories are glued together during the training to provide more training data.
Upvotes: 1