Asking for answer confirmation everytime an user answer in a certain way inside a form

Hi everyone, I have a long form asking for several informations to an user, each slot is validated manually by a custom action. I want to add a confirmation everytime an user answer is near the correct answer. Example: Bot asks user in which season are we:

  • If user answers “Spring” → Bot should answer “Are you sure?” → If user answers yes then the slot is filled, is user says no than the question is repeated
  • if user answers with the correct season (Winter for example) than the bot just fills the slot without asking confirmation
  • if the intent is not recognized as a possible answer, the entire question is re-asked.

I have no idea on how to introduce these “ask the user if his sure about the answer” in the middle of each slot validation. Running RASA2 btw.

I can sketch out a way to do this, but you’ll need to implement it :slight_smile:

You can use the slot validation action for that particular slot to achieve this. You’ll need to implement the logic you describe within that action.

If the user gives the wrong answer, you set a needs_confirmation slot, and add a confirmation slot to the required slots (more on that here). You can set the needs_confirmation slot to the slot name that needs to be confirmed, and None when all slots are filled correctly. Then you’ll also need a response defined for the confirmation slot in your domain, something like:

utter_ask_confirmation: 
    - text: "Are you sure?"

In the validation action for the confirmation slot, you can either leave the slot that needed confirmation be (if the user affirmed), or reset it (if they denied). Note that when you reset the slot, the assistant will ask to fill that same slot again by default.

Then, you’ll also need to do some cleanup:

  • reset the needs_confirmation slot
  • remove the confirmation slot out of the required slots again
  • reset the confirmation slot for next time

Hope that helps, feel free to ask a followup if you get stuck!

1 Like