Forms with multiple question

Hello guys,

I’m building a form with multiple question. But I’m not sure how to write a rule for that. Someone has ideas?

Domain:

  utter_1010_feel:
  - text: How do you feel when you're 10-out-of-10?
  utter_1010_energy:
  - text: What do your energy levels look like?
  utter_1010_behave:
  - text: How do you behave?
  utter_1010_prioritise:
  - text: What are you prioritising?
  utter_1010_self:
  - text: How do you treat yourself?
  utter_1010_habits:
  - text: What daily habits do you have?
  utter_1010_others:
  - text: How do you interact with others?

Stories:

 - story: interactive_story_14
    steps:
    - intent: greet
    - action: utter_common_node
    - action: action_second_step_disambiguator
    - action: utter_1010_showing_up
    - action: utter_1010_intro
    - action: utter_1010_time_check
    - intent: approve
    - action: utter_1010_have_time
    - action: utter_1010_best_self
    - action: utter_1010_best_version
    - action: utter_1010_whole_life
    - intent: inform_how
    - action: utter_1010_example
    - action: utter_1010_visualize
    - action: utter_1010_imagine
    - action: utter_1010_description
    - action: utter_1010_feel
    - action: bestself_form

Rule: This is the rule I wrote, but it asks just one question, fill the first slot and opens for user input again. And I want it to ask the next question first, and so on.

I can’t use the intent because it’s been used for another convos

  - rule: Activate form
    steps:
      - action: utter_1010_feel
      - action: action_listen
      - action: bestself_form
      - active_loop: bestself_form
      
  - rule: Submit form
    condition:
      - active_loop: bestself_form
    steps:
      - action: bestself_form
      - active_loop: null
      - slot_was_set:
          - requested_slot: null
      - action: utter_1010_end

I think you need to change your stories file

Look this examples: rasa-2.x-form-examples/04-asking at main · RasaHQ/rasa-2.x-form-examples · GitHub

- story: interactive_story_1
  steps:
  - intent: greet
  - action: utter_greet
  - intent: request_names
  - action: name_form
  - active_loop: name_form
  - slot_was_set:
    - requested_slot: first_name
  - slot_was_set:
    - first_name: vincent
  - slot_was_set:
    - requested_slot: last_name
  - slot_was_set:
    - last_name: vincent-mcvincent
  - slot_was_set:
    - requested_slot: null
  - active_loop: null
  - action: utter_submit
  - action: utter_slots_values

Take a look at the form examples in the financial-demo.

You should need to write these long stories for a form happy path. Normally, you’d have simple activate and deactivate rules for the happy path as shown here.

There also shouldn’t be a need for all of the slot_was_set conditions in the stories. It’s unlikely that the slots you show are featurized (influence_conversation should be false).

1 Like