I wonder if it’s possible to code a way to jump from a kind of story to another one.
I explain:
Let’s say I’m in a story type (type A for the eg), and depending of some output during this story, I would like to be able to wether end the conversation, or switch to a B type oc story.
To give concrete example
Story A : I ask for the weather.
If the weather is good, the discussion is over,
If the weather is rainy, let’s go to the dialog asking to buy an umbrella (a story that could also live on its own, without any link with the weather. I could just want to buy an umbrella which could lead to this story).
Tried to be as explicit as possible, don’t hesitate to ask more detail if it’s still messy for you.
I’ve similarly been wondering about multi-topic conversations. So taking your example one step further, can we return to the “weather” topic having bought the umbrella - and pick up where we left off? (“Now, will I need it tomorrow?”).
@datistiquo: great that it’s possible - so a good example for the demobot.
I checked the slot point, and I could help but I think not as far as I woud like to go.
I will take another example for that. Let’s say I’m using a recipe, and going through the recipe, I reach a point of the story where I don’t have a specific ingredient (don’t care if my example is functional or not ).
So I would like to go through my storie A (recipe ingredient by ingredient), stop at the egg part (since I don’t have it), asking me if I want to buy some.
I say yes, so I jump to story B, a standalone story asking for what we wanna buy (you can keep number of eggs from story A).
So I buy my eggs and then I want to get back to story A to finish my recipe.
Is it possible? Could you please provide me with an example?
Up again, still no possible example to be detailled? If it’s easy to theorically explain the way to do it, how about giving a practical example? Thanks.
I will try to see if your example can fit in a rasa core model,
if you are detailing a recipe - to bake a cake
User: I would like to bake a cake
Bot: First, let’s check if you have everything with you need to start with. Here is the list of ingredients
eggs, flour, baking soda and baking powder
User: I don’t like eggs
Bot: You could use banana perhaps
User: Yeah sure, what should i do next
Bot: Mix them in a bowl
Now concretly how to design this in rasa core
Story 1
* intent_bake_cake{"recipe":"cake"}
- check_ingredients_present
Story 2
* intent_not_like_ingredients{"ingredient":"egg"}
- find_alternative
Story 3
* inform{"ingredient":["banana","flour","baking powder"],"recipe":"cake"}
- start_instruction_steps_cake
* inform_affirm
- instruction_step2_cake
..
Assuming ingredient is a slot of type list and recipe is a slot of type categorical
you should train your model with Memoization policy to create a definite scenario of most likely steps if everything is okay and for your ML model to detect unlikely scenarios where a combination of each of these stories can happen together and in an unlikely event what should the bot do next.
However your goal shouldn’t be to train a bot to handle your likely scenarios but rather account for the unlikely ones
Thanks very much for your reply. This could give me a hand, but still not really answer to my question.
Maybe I’m not clear enough (I’m sure I’m not ).
The problem here is that it’s a given sentence that change the intent and can lead to another type of story.
In my example, once fullfilling the slots, let say I have validation in my python code behind. And the validation failed cause I answer no to one of the given ingredients (remember I told the story asked me if I have or not an ingredient).
So here, I’m not changing from intent, but just have a validation function that return, let say False for example.
based on that, if I take your example, and I change some things in it:
Here I’m checking my ingredients and if they’re all present, The story go on with the intent inform ingredients, where I tell what I do have. If nothing’s missing then we go with the different instructions.
But if I’m missing one of them, I then would like to be able to go within the story 2 to buy it, then to go back to my previous story to go on with the instructions.
Is this possible with the unlikely scenarii training you’re talking about?
Hope it’s clearer now, don’t hesitate if it’s not.
I think for that you will need to account for such scenarios where one of the ingredients is missing
I guess the confusion most likely comes from what exactly you understand from stories
It isn’t a set of rules that defines the conversation rather stories are most likely what happens in a conversation. FormAction basically gets you started with slot filling but the scenario you explained is unaccounted for since the bot never learnt that most likely this issue might occur where one of the ingredients is missing. You should add such stories that describes what happens when an ingredient is missing and what happens if they are bought in complete instead of breaking it down. However while you train there are two features which are really important
augmentation - this glues some stories together to create longer stories but if you want that for an intent X i should always have one answer Y irrespective of past or present - set it to 0
max_history - this talks about how far back in time, it should look into features to predict the next action. in your case set it to 0 or 1. since slots are features that are featurized throughout the conversation irrespective of history, and since you don’t care about the past intent that can influence your conversation, because if any ingredient is missing you should buy it, then set it to either 0 or 1.
what you wrote as stories there is basically defining rules of the conversation. Rasa core works with examples instead
Interactive learning is a great way to account for such scenarios