Forms does not fill list slot

Hi, I have a slot that is of type list. And this slot is required slot for a form. What I’m seeing is that forms does not request for list slot as empty list is still a list. What is the work around for this?

P.S:

Rasa Version      :         2.8.13
Minimum Compatible Version: 2.8.9
Rasa SDK Version  :         2.8.4
Rasa X Version    :         0.39.3
Python Version    :         3.8.8

@nik202 could you please help me with this?

@lis can you share me the code which you have mentioned in domain.yml for slots and for forms?

@nik202 sure.

slot:

cc_num:

    type: rasa.shared.core.slots.ListSlot

form:

user_form:

    required_slots:

      cc_num:

      - entity: cc_num

        intent: user_details

        not_intent: out_of_scope

        type: from_entity

I’ve also set the config field as:

config:

  store_entities_as_slots: true

@lis you are running code on Rasa open-source or rasa x?

@nik202 rasa x. will there be a difference?

Cross-check this syntax:

DEMO code for your reference:

forms:
  your_form:
    required_slots:
        slot_name:
        - type: from_entity
          entity: entity_name
          intent: intent_name
          not_intent: excluded_intent

I’m aware that code updated on Rasa X GUI but make sure you follow as mentioned in the doc and also cross-check on Rasa X

Please also do let all older versions and re-train the rasa model as rasa oss or rasa x.

I’d also encourage you to first run the code on ros using rasa shell --debug and then check on rasa x.

OK?

@nik202 I’m training rasa on ros, just that instead of using rasa shell --debug im using rasa x like you pointed out. Will try that once and get back. Thanks

@nik202 it’s the same with rasa shell --debug also. Also in my actions.py I’m explicitly setting slot value to None if length of list is not > 0

@ChrisRahme any thoughts?

Sorry, never worked with list slots :sweat_smile:

1 Like

@Juste could you please help me with this?

@lis What details are you setting as slots? Can you share the configuration you are using for your list slot?

@Juste kindly refer to this - Forms does not fill list slot - #3 by lis Basically I have cc_num entity which could take more than one value. cc_num is also a slot of type list. This slot is a part of the form, but it skips filling the cc_num slot as [] is still a list. Any inputs?

@lis sorry for the late response, can you use the rasa interactive and investigate the issue?

still the same problem @nik202

@lis any small screenshot as a reference? are you using rules, maybe issue was there?

I’ll explain my issue a little bit in detail:

nlu data for user details intent :-

dataset containing examples with two entities - cc_num and cc_type. user can enter more than one value in cc_num and just one value in cc_type. So one example in my dataset looks like:

Can you get user details for [34567](cc_num), [37848](cc_num), [23452](cc_num) under [individual](cc_type) type

slots :-

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

form :-

user_form:
  required_slots:
    cc_num:
      - entity: cc_num
        intent: user_details
        not_intent: out_of_scope
        type: from_entity
      - entity: cc_num
        intent: inform
        not_intent: out_of_scope
        type: from_entity
    cc_type:
      - entity: cc_type
        intent: user_details
        not_intent: out_of_scope
        type: from_entity
      - entity: cc_type
        intent: inform
        not_intent: out_of_scope
        type: from_entity

stories.yml :-

- story: user details path
  steps:
  - intent: user_details
    entities:
    - cc_type: individual
    - cc_num: 34567
  - action: user_form
  - active_loop: user_form
  - slot_was_set:
    - cc_num:
      - 34567
    - cc_type: individual
  - active_loop: null
  - action: action_user_details

What I’m seeing when I interact with the bot:

Me: Can you get user details for 23456?

Intent is rightly identified. Entities are extracted properly. Now form is triggered as well

Bot: Please provide cc type.

cc_num slot is set to [“23456”]

Me: individual

After this bot sets cc_type slot to individual and cc_num slot to [] and exits the form to trigger action_user_details. So when it triggers action_user_details slots filled is only cc_type and not cc_num. Ideally it should not exit the form as cc_num is a required_slot. But since it is a ListSlot and since [] is still a list, it exits.

Hope this was clear. Need inputs on why it is going wrong. Thanks in advance :smile:

Can you cross-check the code and can you provide the entities’ values in double route please “3456” so on.

Check slot_was_set also how we mentioned?

Ref: Stories

sure @nik202. I put this slot_was_set after checking how a list slot was getting converted to a story in rasa x. So, if there were more than one number entities it would be like:

- cc_type: individual
- cc_num: 34567
- cc_num: 23457

whereas slots are set in stories like

- slot_was_set:
  - cc_num:
     - 34567
     - 23457

but yes, ill mention slots and entities under double quotes (although in rasa x generated story this wasn’t the case)

@lis are you sure?? check again for slot_was_set Ref: Stories