I am into building my first real bot with Rasa and have tried to find what is the best way of handling cases where I have a quite general intent (like inform) and depending on the entity from the intent I would like to have different answers.
So far I have taken this approach but I wonder if this is the best way to do it. Since it will generate a lot of stories.
any suggestions of what to have with fish?
…and the list goes on…
story: food pasta happy path
steps:
intent: greet
action: utter_greet
intent: inform
entities:
cuisine: “pasta”
action: utter_foodpairing_pasta
action: utter_goodbye
Is it necessary to write similar stories for all type of cuisines or is there a more efficient way since the only part that differs in the story is “intent: inform” and the following action part?
And also since this is the shortest happy path I am thinking I have to write quite some stories that are a bit simliar but when you ask for what kind of food first and then suggest what do drink etc…
Great. I would look at putting this into a form where you could ask to specify a cuisine if the user doesn’t provide one in their initial question. In your domain.yml file the form could look like this:
You could then have a custom action to take the cuisine provided by the user and determine the response so that you don’t have to write stories for each type of cuisine.
I would also make these into a more specific intent like food_pairings instead of inform. An example story would look like:
Thanks. I was actually wondering if I needed to get into custom actions and forms regarding this.
But how would you treat if a user says “Hello, can you recommend a nice wine to veal”? That is a greeting and a specific request in same sentence.
I am thinking what the custom action and your story suggets is a general way of handling a conversation like this:
user: hello
bot: hey there
user: can I get a wine suggestion?
bot: what are having for dinner?
user: veal
bot: oh. then I would recommend a bottle of syrah.
Correct. The way the form would work is if the user provides a cuisine in their message the form will fill the cuisine slot with that value and go to the action server to retrieve the response.
In this example here where no cuisine is provided by the user the cuisine slot is empty and the form will ask the user what kind of food they’re having so that the pairing recommendation can be made.