Dynamic forms: adding slot when intent appears - Rasa Open Source - Rasa Community Forum
Dynamic forms: adding slot when intent appears
post by andreacirillo on Mar 1, 2021
Hi everyone,
We are about to use dynamic forms in our chatbot. Before we start, I wanted to ask you guys a question: is there a way to add a slot if a certain intent appears?
Here’s the thing. Our dynamic form will be used to set an appointment. The user might ask to have a look at available appointments from a certain date
“I want to set an appointment from 04/02/2021”
If this message appears in our form it will be classified in a specific intent and I want to add a slot in order to store the date “04/02/2021”. Is it possible?
Thanks, Andrea
post by alexyuwen on Mar 1, 2021
Hi Andrea, this can be achieved by overriding the required_slots method as shown here: Forms. However, for the example you gave, I’m wondering why you would need to dynamically add slots? Because if the user doesn’t provide a date, wouldn’t that be valuable information that you’d want to ask them for? If so, it would be best to just define that slot in the domain. One of the features of forms is that if the user provides slot information even when that specific slot isn’t being asked for, that slot will still be filled.
post by andreacirillo on Mar 2, 2021
Hi Alex
This is how we used to work. We are using Duckling for NER, and as far as “time” dimension is concerned in the Italian language, Duckling tends to extract entities where there is no need to. We had no choice but deactivating the auto_fill in slots and use them only in forms
Of course, if you have an alternative option, we are open to suggestions!
post by alexyuwen on Mar 2, 2021
Hi Andrea, have you considered conditioning on an intent in the validation function for the time slot? That way, the slot would only get set if the user actually wanted to set an appointment time.
post by andreacirillo on Mar 3, 2021
Hi Alex,
Thanks for the suggestion! We actually do it already using the slot mapping. The problem is that slot mapping is impossible to do outside a form. If we didn’t have to use a form it would be easier Of course, I think this would be possible using a custom component.