I am developing a chatbot using Rasa NLU and Rasa Core. My bot mainly queries a database for some results. I am kinda stuck in a situation regarding the filling of the slots in my domain.yml file. Here is my bot setup and what I want it to do:
Some intents require slots, and I use the values of these slots to query the database. An example would be: LookForShop intent, which requires a location entity (slot). I train this intent with examples like: “show me the nearest shop in Ontario”. If a user asks “show me some shops”, I want the bot to ask the user for the location, but if the user enters the location with the question from the first time, I want to just return the DB results directly. Basically something like:
## Story 1
* LookForShop{"location": "London"}
- action_LookForShop
## Story 2
* LookForShop
- utter_AskForLocation
* LookForShop{"location": "London"}
- action_LookForShop
And a chat flow like:
u: show me some shops
b: please specify a location.
u: LA
b: here are some shops in LA.
and
u: show me some shops in Montreal
b: here are some shops in Montreal.
But for this to work, my NLU_Data.md file should be something like:
## intent:LookForShop
show me some shops
show me some shops in [Barcelona](location)
[Lithuania](location)
In the case where there is one intent -other than chitchat and small talk intents-, this works fine, but the problem is that I have multiple intents that share the same entity (slot). An entity (location) is shared amongst intents like LookForShop and LookForCafe and I simply can’t use the previous story setup as I will have to train the Rasa NLU on examples like:
## intent:LookForShop
show me some shops in [Paris](location)
[LA](location)
and
## intent:LookForCafe
show me some cafe in [Ontario](location)
[Dubai](location)
I would like to hear your suggestions on what my stories and actions should be.
The problem is that I have multiple intents that have and require the same entity, and although I have tried formactions, I still can’t reach the first (basic) chat flow that is shown above, not mentioning implementing it with multiple intents and entities . I would truly appreciate any help on the manner.
You will have to build a form action. The form will be activated upon intent LookForShop and then validate the location slot and if it isn’t filled yet, it will run utter_ask_{missing_slot} (which in your case you have to rename utter_AskForLocation to utter_ask_location for it to work) before the from triggers to run action_LookForShop.
The form handles both requesting slots, and when all required slots are filled, running the specified action.
You could have two forms, one for shops and one for cafes, but I think the better option in this case would be to make a slot for place that can be filled with cafe or shop and then is one of the required slots in the form. This very much depends on your use case and other intents and actions of the bot though.
The weather bot tutorial is using very old rasa versions, maybe try updating to newer versions.
I see you tried forms, and this should work to reach a story-line as you described.
Can you post what the exact issue you are having with the forms?
How do your stories look using forms?
Hi @pwessel, thanks a lot for your reply. I actually have somewhat of a private context that I can’t share, so I have created an equivalent implementation (stories, nlu_data, domain and forms), and that is the one I am sharing. Right now I have modified the ‘equivalent’ model slightly. Here are all the files I am using: