Allow User to Change Answer

Looking for documentation or any information on how to allow the user to change a response when using a form to fill a single slot.

There is an active form which uses utter_ask to fill a slot. Then to ask the user, is that correct, and the user can say yes or no, and change their answer.

We can do this without a form, or with a form as long as it’s not the last or only slot. But when you are using a form with only one sot, or the last slot how do you do it? It seems like the problem we are running into is that the form is closed/not active, and so the FormAction isn’t firing. (?)

You can add more slots for each yes/no answer and a validation function to reset the other slots. This way, the yes/no slot becomes the last slot.

Thanks, that’s a solution of sorts I guess. At least it could be used for small use cases. At scale, it’s not workable though.

There really needs to be way to confirm form information, that is not form information. Logically, that’s what our notion of “correct” is, which by definition always functions at a different level.

And it’s a cumbersome approach, because instead of having a method to call to verify the form, you have to add new slots to every form you want to verify. For a bot that has a lot of forms, this can quickly become unwieldy.

But moreover, you now have 2 problems- because how do you confirm THAT form answer is correct? You’re stuck in an infinite loop, because you have to add another answer to confirm the answer.

Yes, you can use FormValidationAction for validating your answers. I gave you that answer because that’s what you asked for, a way for yes/no answer. Also, you don’t need another answer to confirm the yes/no, because you will validate it in the validation function.

Thanks. Although I didn’t mean yes/no in that more limited sense of button pushing, but assumed (sorry) it was obvious that we’re talking to the user conversationally. So I probably should have said affirm or deny instead of yes or no.

And thanks also for the FormValidation suggestion, although that seems like an overly complicated approach.

Validation functions (which use super()) should be used for performing validation on the data itself, that’s what validation is. (It can also be validated against a back end API.)

Verification (asking the user to confirm something is correct) is a logically different operation, and only bears similarity in a colloquial sense of the words. Adding a verification step inside form validation, where you dispatch a message to the user, collect their response, and then pass flow control state seems fraught.

A good way to think about this is that validation should fail if an error is thrown. You’re making sure everything is ‘kosher.’ Verification isn’t throwing any errors (user response is not an error.)

We’re looking for a way in Rasa to verify with the user that the information is correct, which seems (a) impossible to do for the last/only question on a form, and (b) impossible to do conversationally, rather you need to strictly enforce a category choice of “yes” or “no.”

If either (a) or (b) are not true, please do LMK!

And thanks again for the suggestions!

1 Like