How to use stories for context switching

Accoring to the Tutorials of the rasa open source, I can not accomplish how to use stories for context switching, my rasa version is 2.0. rasa open source give a story as follow:

stories:

  • story: Context switch from credit card payment to money transfer steps:
    • intent: pay_credit_card
    • action: credit_card_payment_form
    • active_loop: credit_card_payment_form
    • intent: transfer_money
    • active_loop: null
    • action: transfer_money_form
    • active_loop: transfer_money_form
    • active_loop: null
    • action: utter_continue_credit_card_payment

what should I do? I will very be thankful if someone can support me or give me some suggestion.

@xiaolinpeter, when credit card’s form is active and your assistant identify another intent, you can just ask for a confirmation before switch to money transfer. For example:

- story: Context switch from credit card payment to money transfer:
  steps:
  - intent: pay_credit_card
  - action: credit_card_payment_form
  - active_loop: credit_card_payment_form
  - intent: transfer_money
  - action: utter_continue_credit_card_payment
  - intent: deny
  - action: action_deactivate_loop
  - active_loop: null
  - action: utter_transfer_money
  - intent: affirm
  - action: transfer_money_form
  - active_loop: transfer_money_form
  - active_loop: null

@marcos.allysson thank you very much, I will try the solution you gived soon

Hi Marcos, I’m having a similar situation here, but I’m not able to activate the other form after capturing the intent. 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