Forms with list slot

Hi @Juste, I have a use case where I need two types of data to make an api call- numbers(list) and their type(text). I want the user to fill at least one number. Now I’m aware that if I make the number as a list slot the form can exit even if the user does not provide any number. What is the work around to implement a slot that can collect a list of numbers where the bot should exit form only if the user provides at least one number and it’s type

Or maybe @nik202 could provide some insights?

A validation custom action.

@Gehova can you provide an example? if I’m not wrong a validation function runs after a slot is set. But I have a problem even before that I think. Example:

User: Can you get user details for B2345, H3456, JY347? //intent is identified here with all the numbers as entities

Bot: Can you provide the type of the customer? //form is activated here and the number slot (list) is filled here

User: Individual //type (text) slot if filled and number slot (list) is set to null

My understanding is in the second user utterance, the form is filling both the slots although only the type slot is requested. What should I do prevent this?

@lis can you provide some examples?

This is my domain.yml file:

version: '2.0'
config:
  store_entities_as_slots: false
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

intents:
- user_details:
    use_entities: true
- inform:
    use_entities: true

entities:
- cc_type
- cc_num

slots:
  cc_num:
    type: rasa.shared.core.slots.ListSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true

  cc_type:
    type: rasa.shared.core.slots.TextSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true

responses:
  utter_ask_cc_num:
  - text: Please provide valid cc number(s)
  utter_ask_cc_type:
  - text: Please provide cc type

actions:
- action_user_details
- validate_user_details_form

forms:
  user_details_form:
    required_slots:
      cc_num:
      - entity: cc_num
        intent: user_details
        type: from_entity
      - entity: cc_num
        intent: inform
        type: from_entity
      cc_type:
      - entity: cc_type
        intent: user_details
        type: from_entity
      - entity: cc_type
        intent: inform
        type: from_entity

The user details form should collect two types for values - cc_num which is a list of numbers and cc_type which is the type of these list of numbers to make a api call later. Now, there are four ways of asking a question as there are two entities in the question (cc_num and cc_type):

  1. Can you get user details? - the one where the user does not provide entities in the first go. a form is activated and these values are then collected
  2. Can you get user details for Y37846, U82374, H237834, Y672389? - the one where one of the entities (cc_num) is provided in the first go. a form is then activated to collected the other one (cc_type)
  3. Can you get individual user details? - cc_type is there, need to collect cc_num
  4. Can you get individual user details for Y37846, U82374, H237834, Y672389? - all the required details are provided in one go. A form is activated, sees that all the required slots are filled and proceeds to activate action_user_details.

Now the problem I have is, like in the previous comment a slot of type list is expected while requesting for cc_type slot. (2nd example). So, I want to know if there is another way of approaching this problem. How would you @nik202 solve this?

Thanks in advance!