RASA Context Switch not working

Hi all, I’m not able to activate another form after capturing the intent when already in an active form. Basically, I need to change in the middle of an active form to a different one. Could you please help me :sob:? I tried everything I thought to change/try, leave bellow details of my stories:

** RULES**

version: "2.0"
  - rule: unhappy path for create opportuity
    condition:
    # Condition that form is active.
    - active_loop: create_opportunity_form
    steps:
    # This unhappy path handles the case of an intent `chitchat`.
    - intent: update_task
    - action: utter_change_form_update_task
  
  - rule: unhappy path for create opportuity
    condition:
    # Condition that form is active.
    - active_loop: create_opportunity_form
    steps:
    # This unhappy path handles the case of an intent `chitchat`.
    - intent: update_task
    - action: utter_change_form_update_task

STORIES

stories:
  - story: create opp
    steps:
    - intent: create_opportunity
    - action: create_opportunity_form
    - active_loop: create_opportunity_form
    - active_loop: null
    - action: utter_finished_create_opp

  - story: update task
    steps:
    - intent: update_task
    - action: update_task_form
    - active_loop: update_task_form
    - active_loop: null
    - action: utter_finished_update_task

CONFIG for Core

policies:
  - name: AugmentedMemoizationPolicy
    max_history: 4
  - name: TEDPolicy
    epochs: 50
  - name: RulePolicy
    core_fallback_threshold: 0.4
    core_fallback_action_name: "action_default_fallback"
    enable_fallback_prediction: True

FORMS

forms:
  create_opportunity_form:
    required_slots:
      account_name:
      - type: from_entity
        entity: account_name
      - type: from_text
      amount:
      - type: from_entity
        entity: amount
        intent: inform
      - type: from_text
        entity: amount
        intent: inform
      licenses:
      - type: from_entity
        entity: licenses
      - type: from_text
        entity: float
      product_suite:
      - entity: product_suite
        type: from_entity
        intent: inform
      stage:
      - entity: stage
        type: from_entity
        intent: inform
      next_step:
      - type: from_text
      - type: from_entity
        entity: next_step
      next_step_date:
      - entity: DATE
        type: from_entity
      - entity: DATE
        type: from_text
      close_date:
      - entity: DATE
        type: from_entity
      - entity: DATE
        type: from_text
      description:
      - type: from_text
  update_task_form:
    required_slots:
      account_name_task:
      - type: from_entity
        entity: account_name_task
      - type: from_text
      subject:
      - type: from_text
      priority:
      - type: from_entity
        entity: priority
        intent: inform_task
      status:
      - type: from_entity
        entity: status
        intent: inform_task
      activity_date:
      - type: from_entity
        entity: activity_date
      - type: from_text
        entity: DATE
      comments:
      - type: from_text

@npattarone Heya! Mean you want to break the form and want to start the new form? or when one form finished next form show? can you elaborate more with some example?

Hi :smiley: ! Yes, I want to break the current one and start the new one and then, when the new one is finished, ask if they want to go back to the previous one. Below the initial part where interrupts the ongoing form:

  • intent: create_opp
  • action: create_opp_form
  • activate_loop: create_opp_form
  • intent: update_task (HERE CHANGING FORMS!!)
  • action: utter_ask_switch
  • intent: affirm

@npattarone Right; have you seen this doc page Forms ? In this you know how to activate and deactivate forms?

@npattarone Please see this Youtube video: Introduction to Rasa Forms | Rasa Tutorial - YouTube

@npattarone Even please see this Series Video: Conversational AI with Rasa: Basic Forms - YouTube

Note: Don’t use two same rules as I can see in above code, stick with one stories or rule?

I guess you will solve this issue soon.

1 Like

Yes :frowning: I read them (sooo many times) and could not do it. I think it is something related on how I’m writing the rules/stories, seems to always capture rules and not stories.

Thank you so much for helping me :slight_smile: I hope it too! hehe have a nice day!