In some custom actions I would like to set multiple slots depending on the value of other slots. For example I have a time slot which is filled through duckling and I would like to fill two separate hour and date slots.
Looking at the medicare locator, slots are set using the SlotSet function return [SlotSet("facility_address", address)] when returning the customaction.
How would I go for updating multiple slots?
an array of SlotSet causes this error: action_server_1 | ValueError: dictionary update sequence element #0 has length 4; 2 is required
an object like this return {"time": time,"time_confirmed": True} works.
Is this the correct way to update multiple slots or can I use SlotSet in the body of the function and then return []?
Why should SlotSet be the output of the customaction?
Hi @laujen, returning a list of SlotSet events should work alright in Rasa 2.x as the docs say (I checked using 2.1.x a while ago). Which version of Rasa are you using? Could you also share (at least the relevant parts of) the action code that doesn’t work and maybe also some other parts of your config/domain/data if you want me to try to reproduce the error that you’re getting?
So, there are differences based on whether your custom action extends Action or FormValidationAction. In the latter case, you should follow this example in the docs and indeed return a dictionary like you do, not a list of SlotSet events
Note: no need to use type List for the return type. Dict[Text, Any] covers cases where the dictionary has multiple entries.