How to Repeat or Loop a story until user stops it

I want to keep repeating a story until user says done or stop. I use buttons for the options presented to the user and these buttons set a slot facility_type.

The dialogue flow can be assumed like this

User - Hi
Bot - what do you want to know?
1. Weather    2. Temperature
User - 2. Temperature
Bot - Provide location
User - Someplace (*This sets slot location to Someplace and data is fetched through an API*)
Bot - This is the temperature of Someplace
Bot - Do you want to explore other options
User - Yes
Bot - repeats the question again
User - 1. Weather
Bot - The Weather of Someplace is this. 
Bot - Do you want to explore other options
User - No
Bot - Have a good day!

Exploring the forum I found that forms can be used but I still didn’t understand how to implement this loop using forms or checkpoints or rule.

I am new to Rasa and building my first chatbot.

My entities and slots are as follows

- location
- facility_type

    type: unfeaturized
    type: unfeaturized
1 Like

@JulianGerhard Can you help me with this. Thanks in advance.

Good Morning @deekshant ,

this doesn’t seem to be a big issue. I think since you are relatively new, you might want to learn rather than I simply write the plain answer down - right?

You are right - you might want to use Forms but I’d encourage you to first take a look at your situation:

Actually you want to continuously provide two options for the user to interact with the AI. Depending on the choice, you want to utter the coresponding response and then start all over again - except the user wants to actively stop. I’d recommed to read the max history section of the TEDPolicy and think about how it could help you with this case. There is this sample story:

  - story: utter help after 2 fallbacks
    - intent: out_of_scope
    - action: utter_default
    - intent: out_of_scope
    - action: utter_default
    - intent: out_of_scope
    - action: utter_help_message

Any idea how this might help? If you got no clue, I’d in addition recommend this excellent video of Vincent, which - besides other things - explains looping in TED.

Kind regards

Hello @JulianGerhard , the video you suggested helped me to have a better understanding but I don’t think that it can help me.

This is my story

- story: happy path
  - intent: greet
  - action: find_facility_types (*This creates buttons to present to user and fills slot facility_type when user selects any button*)
  - intent: inform
    - facility_type: weather
  - action: user_form
  - active_loop: user_form
  - active_loop: null
  - action: action_facility_search (This finds the info through the API about the selected facility_type and displays to user)
  - intent: thanks
  - action: utter_thanks

Now I want to extend this by asking the user whether they want to find details for the other options. If Yes then I will display the options again but keeping the location same i.e. I shouldn’t ask for the location but the facility_type will be set by the options that they select and if they don’t want to see other options then I will utter thanks. Now my problem is that I can’t figure out how to show the options again.

What I understood from the video was that the TED policy can help me with remembering conversation history but I don’t see how it can help me to present the options again to the user after I have shown the details for the option selected before. It is like the story will repeat like a fresh story but having the location not changed. And One more thing is like even if the user asked for the other option and then I will show the options and give details and again when i ask if they want to explore other option and then they select the first option again I will show them the details and this will continue until the user denies to explore options i.e. they can keep asking for options even if they know the details already.

Please don’t mind if I am being stupid and also is it possible to implement my thoughts.