Form next requested slot incorrectly asked in Rasa 3.0, although it was removed from required slots

In Rasa 3.0, when removing a form required slot using a custom action, it is still requested as part of form looping.

Below is the data model where form required slots are: form1_slot1, form1_slot2, form1_slot3:

version: '3.0'

recipe: default.v1

config:
  store_entities_as_slots: true
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- form_start
- intent1
- intent2
- intent3

entities:
- form1_info1

slots:
  form1_info1:
    type: text
    mappings:
    - type: from_entity
      entity: form1_info1
  
  form1_slot1:
    type: text
    influence_conversation: false
    mappings:
    - type: from_intent
      value: Filled
      intent: intent1

  form1_slot2:
    type: text
    influence_conversation: false
    mappings:
    - type: from_intent
      value: Filled
      intent: intent2

  form1_slot3:
    type: text
    influence_conversation: false
    mappings:
    - type: from_intent
      value: Filled
      intent: intent3    

forms:
  form1:
    ignored_intents: []
    required_slots:
    - form1_slot1
    - form1_slot2
    - form1_slot3

responses:
  utter_ask_form1_slot1:
    - text: "intent1 will fill slot1"
  utter_ask_form1_slot2:
    - text: "intent2 will fill slot2 slot"
  utter_ask_form1_slot3:
    - text: "intent3 will fill slot3 slot"
  utter_slots_values:
    - text: "form1_slot2 is {form1_slot2}, form1_slot3 is {form1_slot3}, form1_info1 is {form1_info1}"   

actions:
- validate_form1

nlu:

rules:
- rule: Activate form
  steps:
  - intent: form_start
  - action: form1
  - active_loop: form1
  
- rule: Submit form
  condition:
  - active_loop: form1
  steps:
  - action: form1
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  - action: utter_slots_values  

‘form1_slot2’ was removed in FormValidationAction required_slots() method:

class ValidateForm1(FormValidationAction):
    def name(self) -> Text:
        return "validate_form1"
    
    async def required_slots(
        self,
        domain_slots: List[Text],
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
    ) -> List[Text]:

        slot_to_remove = "form1_slot2"
        if slot_to_remove in domain_slots:
            domain_slots.remove(slot_to_remove)
        return domain_slots

’rasa shell’ output is:

Your input ->  /form_start
intent1 will fill slot1
Your input ->  /intent1
intent2 will fill slot2 slot
Your input ->

intent2 will fill slot2 slot was the utterance for ‘form1_slot2’ which was removed from required slots and should not have been requested.

On the other hand, in Rasa 2.8.6, with the same custom action implementation, ‘form1_slot2’ was not requested and form deactivated without filling this slot. This behavior has changed in Rasa 3.x.

Could you, please, help on clarifying if similar behavior as in Rasa 2.x should now be implemented differently in Rasa 3.0? Or this is a bug in 3.0?

Thanks!

What displays if you do print(domain_slots) at the start of the function?

I added 2 printing messages for domain_slots - at the begining of the function (before removing the slot) and after removing the slot. The output is:

domain_slots before removing form1_slot2:  ['form1_slot1', 'form1_slot2', 'form1_slot3']
domain_slots after removing form1_slot2:  ['form1_slot1', 'form1_slot3']

Hmm looks like a bug. You’re not the first person here with this problem.

Please report it as in issue on GitHub at https://github.com/RasaHQ/rasa/issues.

Opened Issue #10536

1 Like

Thanks for linking to the issue here! Please mark it as solution so that people will directly know to go there :slight_smile: