Custom list of slots in a form

Hi, I am trying to create a dynamic form that gets the slots from an external tool. The use case is that the user chooses an item from a catalog, and each item has different list of parameters that needs to be collected. I understand that I need to use the FormValidationAction and override required_slots according to this documentation: Forms Here are my questions:

  1. I don’t know what the parameters will be, and how many of them. Is there more elegant way to add the slots than the fixed number of variables defined in the domain with names variable1, variable2, etc, with corresponding extract_, and action_ask_ actions that do exactly the same?
  2. The questions for the parameters are stored in the external tool. I am extracting the questions in parameters in the required_slots method, and want to pass them to the action_ask methods. I tried to use a slot for this, but it seems that when the action_ask method is called, the slot is not yet filled. Do I need to use a global variable storing the forms for all conversations, or there is a way to use some Rasa mechanisms for that?
  3. The most important - When I implement the required extract_ actions, the action_ask actions are ignored and the form tries to fill all additional slots without asking the user. What am I missing?

hey @Cekir,

  1. there will need to be some unavoidable work upfront of mapping the variables to slots and defining them in the domain (along with the collecting response). Hopefully, most of the variables are repeatable so you aren’t defining too much. After that is done, you can just return a list of slots that you retrieve from the catalog information

  2. just to confirm, are you referring to the questions to ask the user to fill that particular variable/slot? Based on number 1, I think you’ll need to set all the action_ask questions upfront anyway. If you’re using action_ask now, you can also try using the dispatcher to send the question you retrieve rather than showing the filled slot.

  3. I’m guessing this is because you don’t have all the slots defined? or can you give more detail on this behavior?

Hey @desmarchris Thank you for your answer,

  1. Well, the problem is, that in fact I do not have the full list of variables at the moment of starting Rasa (to be precise, the list of variables may change while Rasa is running). What is more, there will be thousands of variables in the production. Not really feasible to define all of them in the domain, unless there is a way to add the slots to Domain when Rasa is already running (is there? Domain seems like just a Dictionary in the code). One way to overcome this might me monitoring the list of variables in an external tool and every time the list changes, the domain and the action server code would be automatically updated and Rasa re-trained and re-started, but having thousands of slots I worry about the efficiency and it does not seem like an elegant solution anyway.

  2. So to clarify what I am trying to do, is that I define the slot “variable1” and extract_variable1 and action_ask_variable1. Then, when I detect intent “request_order” I call the external tool to collect the question for the variable1 from it (yes, the question to ask the user to fill the first variable/slot). Then I use this collected question in the “action_ask_variable1” and send it to the dispatcher. Now, to pass the question from the action_request_order that is triggered after detecting “request_order” intent to action_ask_variable1, I am currently using the global variable.It would be however good if I could use some conversation-related mechanism, like the tracker (e.g. variable1_question slot) instead of using global variables.

  3. As said above, I do have slots like variable1 and the corresponding functions, and the problem is, that when I define the extract_variable1, extract_variable2, and so on, the bot does not enter the action_ask_variable1, action_ask_variable2, and so on, instead it runs all the extract_ actions right away. If this is not intended, then i can extract the code (not able to copy and paste, as this is part of a bigger project).