Looping stories

Hi all,

I have a story which will:

  1. Ask what does the user wants to do today. (Eg Option A, B, C)
  2. Allow user to fill up some forms (Eg. Personal info)
  3. Check if the user wants to make another option in step 1.
  • If yes, go back to step 1 and the story repeats
  • If no, exit the bot.

The user should be able to repeat the story infinitely until he/she does not want to continue.

I understand that the suggested method to achieve this is through forms. However, I will be having nested forms, which I am not sure how to handle. (I’m thinking if we can invoke another action within a form)

Any advice will be highly appreciated.

Thank you.

Hi there!

I don’t think you need or even should use stories for this type of behaviour. I think instead you could have two rules, something like:

rule: don't want to continue
steps:
 - action: utter_ask_continue
 - intent: deny
 - action: exit

rule: do want to continue
steps:
 - action: utter_ask_continue
 - intent: affirm
 - action: ask_what_user_wants_to_do

As for the nested forms – is this perhaps something you could do with a single form that has dynamically added slots? If not, can you tell me a bit more about how you want to use nested forms?

Hi @fkoerner, thanks for the advice. I tried it out on a simple bot with 2 options. When I used the default pipeline, the bot doesn’t continue beyond the second round (the bot stopped predicting just before the second utter_ask_continue. But it works after I added AugmentedMemoizationPolicy with max history 20.

stories:
  • story: Check weather steps:

    • intent: greet
    • action: utter_greet
    • intent: check_weather
    • action: weather_form
    • active_loop: weather_form
    • active_loop: null
    • action: utter_weather_forecast
    • action: utter_ask_continue
  • story: Check bus steps:

    • intent: greet
    • action: utter_greet
    • intent: check_bus
    • action: bus_form
    • active_loop: bus_form
    • active_loop: null
    • action: utter_next_bus
    • action: utter_ask_continue

Could you advise on the configurations for the story to behave correctly?

Thank you.

Hi @Jason73 sorry for the bit of a delay – I was offline. What rules are you using?

Hi @fkoerner ,

These are the rules I’m using:

- rule: don't want to continue
  steps:
  - action: utter_ask_continue
  - intent: deny
  - action: utter_goodbye

- rule: do want to continue
  steps:
  - action: utter_ask_continue
  - intent: affirm
  - action: action_clear_form
  - action: utter_ask_what_user_wants_to_do

Thanks!

Could you share the two configurations?

Also, it might help if you extend the rules above to always utter_ask_continue after a form is submitted. Do you have rules for form submission? Or how are you handling this?