How to avoid default re-asking of slot if slot validation fails?

Hi there! There are a couple of ways to do this, depending on the complexity of your case.

@alexyuwen, you could get clarification from the user as follows:

  • in the validation method for time dynamically add a slot e.g. clarify_time to the be the next slot in requested_slots if the value of a slot isn’t quite sufficient.
  • return {"time":"value"} as usual (so not nullifying the value, and not reasking for it.)
  • use some bot utterance to ask the user to clarify the time ("Could you please specify am or pm?")
  • in the validation method for clarify_time, update the original value of time with the clarified time.

@samvatsar, I think your case might be better suited for buttons. If you have a finite number of training types, it might be easiest to just ask the user to select the right one, rather than relying on them to type it in correctly. If you don’t want to do this, you could override request_next_slot and put a condition in to dispatch a different method.

You could also (this is slightly more complicated), implement a custom action for asking about a slot, and perform validation in there. If the slot wasn’t validated, you could dispatch a custom message depending on what was wrong with it.

How does that sound?