How to fill a form twice within one story to peform a subsequent action?

Hey folks, I am building a chatbot for booking seminars. I wanted to create a story in interactive learning in which one user might book two seminars in one session. For booking a seminar, I’m using a form action which asks for course, location and date before doing the actual booking. However, when I tried to realise the above scenario, I encountered the problem that when I wanted to book the 2nd seminar, all requested slots were already filled from the first booking, so the questions about location and date were just skipped. I tried to set those slots to None after the first booking was confirmed, but that didn’t work.

So is there any way to reset requested slots so I could perform this action twice?

Generated Story 1642046423313375900

  • book_seminar{“course”: “Machine Learning”}
    • slot{“course”: “Machine Learning”}
    • utter_ask_name
  • inform{“given-name”: “teresa”, “last-name”: “williams”}
    • slot{“given-name”: “teresa”}
    • slot{“last-name”: “williams”}
    • action_verify_user
    • slot{“user_verified”: “True”}
    • slot{“employee_id”: 10}
    • action_display_locationAndDates
    • slot{“title”: “Machine Learning”}
    • seminar_form
    • form{“name”: “seminar_form”}
    • slot{“requested_slot”: “location”}
  • form: inform{“location”: “frankfurt”}
    • slot{“location”: “frankfurt”}
    • form: seminar_form
    • slot{“location”: “frankfurt”}
    • slot{“requested_slot”: “date”}
  • form: inform{“date”: “02.04.19”}
    • slot{“date”: “02.04.19”}
    • form: seminar_form
    • slot{“date”: “02.04.19”}
    • form{“name”: null}
    • slot{“requested_slot”: null}
    • action_book_seminar
    • slot{“booking_confirmed”: “True”} - slot{“date”: “None”} ** - slot{“location”: “None”}**
  • book_seminar{“course”: “excel”}
    • slot{“course”: “excel”}
    • action_display_locationAndDates
    • slot{“title”: “Advanced Excel functions and formulas”}
    • seminar_form
    • form{“name”: “seminar_form”}
    • form{“name”: null}
    • slot{“requested_slot”: null}

In my opinion, the only thing that you need to do is think about which slots do you need only for a particular booking and which slots would you need for all bookings. Then, when you submit the form the first time, in the submit function, call some code that saves the booking (or a custom action, I don’t know how your code works), and afterwards, clean the slots that are specific to that booking and keep the ones that are not (such as the name of the person chatting with the bot or their employee ID).

Does that help? Feel free to ask further questions.

Cheers!

Thanks for your answer Patrick! And yes that’s what I thought about. The question is now how do I reset only the slots specific to one booking (date, location)? I tried to set slot{“date”: “None”} & slot{“location”: “None”}, but that didn’t trigger the form action to ask for new values. Do I need to alter the requested_slot maybe?

You need to do it in the stories, that’s true. The stories are required to train the core model properly, so that it knows how to predict the rest of the conversation. But core does not set the slots by predicting an action(I think?), it just uses the fact that actions are setting slots to predict what to do next (and by the way, if I’m not wrong, except if it’s a boolean or categorical slot, the value of the slot should not influence the story, only if it’s set or not).

You also need to do it in the form, that is what sets slots! I would try to perform the things you need to do with the slot values in the submit function first (that is, after all the slots values have been requested by the form) , and if you need to keep certain slots for after the form has been executed or for the next execution of the form, set the value of the form slots to other slot. (something like having two slots, one called ‘name’ and the other ‘form_name’ and in the submit function, do what you have to do with the form slots and then set the slots corresponding to the form slots).

I am not 100% confident this will work, but it’s worth a try! I am also currently learning form actions at the moment.

So, setting the date and location slots to None after running the booking action actually works, I only had a minor mistake in my code.

I put the None in slot{“date”: “None”} into quotation mark, so it was interpreted as a string I guess. With slot{“date”: None} the form requires the date and location inputs again when doing the 2nd booking, so it seems both slots got reset.