How to stop a form when enough slots are filled?

I was using UnfeaturizedSlot type and return {“requested_slot”:None} to stop the form when enough slots are filled. Everything was working fine until UnfeaturizedSlot type was deprecated.

requested_slot:
   type: rasa.shared.core.slots.UnfeaturizedSlot
   initial_value: null
   auto_fill: true
   influence_conversation: true

I tried using TextSlot type for requested_slot slot but the form continues even after the requested_slot is set to None.

Here is a sample custom action ,

  def validate_...(..):
     global value, threshold
     if value >= threshold:
        dispatcher.utter_message(text='The threshold is reached, enough slots are filled') #for own reference to see if condition is working
        return {“requested_slot”:None}
     elif tracker.get_intent_.....:
        return {'slot_name':value1}
     return {'slot_name':value1}

I read the documentation but I couldn’t figure how to resolve the problem.

What appears in the debug? Are your history and rules ok?

This is the same story and rule I used with UnfeaturizedSlot which was working properly.

- story: main path
     steps:
     - intent: user_greet
     - action: utter_greet
     - action: mood_form
     - active_loop: mood_form
     - active_loop: null
     - action: action_submit


 - rule: submit form
      condition:
      - active_loop: null
      - slot_was_set:
        - requested_slot: null
      steps:
      - action: action_submit

The change I made is,

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

Is there any change to be made for story, rule, requested_slot?

  • rule: Activate form steps:

    • intent: request_names
    • action: name_form
    • active_loop: name_form
  • rule: Submit form condition:

    • active_loop: name_form steps:
    • action: name_form
    • active_loop: null
    • slot_was_set:
      • requested_slot: null
    • action: utter_submit
    • action: utter_slots_values

As I’m just learning for a while, I hadn’t seen this construction in rules. In submitform in condition: wouldn’t the form be active yet?