How do you handle this situation for a restaurant reservation bot:
I want to book a table for 3 people
If this is the user input, the user intent to book table is extracted and the no of people “3” is also extracted.
But what if the user only says,
I want to book a table
They don’t mention the number of people. If that is the case how do I detect they have not said the number of people and ask them something like “How many guests would be there?”
This is how I am writing the intent.
- i want to book a table
- book table
- reserve table
- can i reserve a table?
- book seat
- make a reservation
- i want to book a table for 3 people
- book table for 3 people
- reserve table for 3 people
- can i reserve a table for 3 people?
- book seat for 3 people
- make a reservation for 3 people
Sorry, this maybe a silly question but I am a noob in conversational AI and RASA is my first attempt at building one. Could you guys help me out?
Hi @navendu-pottekkat. You situation is a perfect use case for slots. You can define a number of people as a slot with a type
text and then write a few training stories which would teach your assistant to ask for this details if it wasn’t provided.
If there are more details like this which are necessary for your assistant to perform a specific action, you may consider using forms. Forms allow to define required slots which then makes sure that those slots are provided before moving forward.
You can find more info on that in our documentation. Have a look and if you have more questions, let me know
Thanks for the reply!
So if these slots are not filled i.e the user only provided the info “I want to book a table” then the bot should ask “How many people?”. If the slot is filled, then the bot can straight away book the table. Is that right?
How would I implement it? Is there a straightforward way?
Yes, exactly. The simple way to implement it would be to define
number_of_people as a slot. In your
(here, type text means that the slot will be featurized in a way that depending on whether or not this slot is filled, it will influence the dialogue). Also, here I am assuming that in your nlu.md file you have some examples teaching your NLU model to extract the entity
number_of_people. Alternatively, you can use duckling which would not require annotations, but the name of the entity (and slot) would then chance to
Then, in your
stories.md file you should write some example stories teaching your assistant to handle the situation when the
number_of_people details is provided and when it’s not:
## Book a table when the number of people is provided
## Book a table when the number of people is not provided
If you have more details which your assistant should ask the user before booking a table, then you should use forms instead since modelling those situations with only slots can be very complicated.
Thanks for the solution @Juste I think this is the perfect solution for my use case. I am totally new to RASA that is why I am always asking questions at the forum. Thanks for the help!
This is great @navendu-pottekkat. Forum is the best place to ask these questions and we are always happy to help