How to handle chitchat while inside a form action?

Hi there,

So I got it working in a way that was fine for my requirements. But I am not sure this is best practice.

The problem was the form policy was always predicting the form_action as the next action with a confidence of 1 even if unhappy paths were in the training data.

My solution was to throw an error that would exit the form like this:

if slot == ‘birthdate’:

try:

slot_values[slot] = self.birthdate_calculation(self, dispatcher, tracker, slot_values, slot, Date)

except ValueError:

print(value + “IS THE WRONG TYPE FOR BIRTHDATE”) dispatcher.utter_template(‘utter_default’, tracker) # validation failed, set slot to None slot_values[slot] = None

And then Keras policy came into play, and this policy would predict the next action correctly following what happens in the training data (chitchat). I have a chitchat_action that handles all chitchats and returns a followup action. This followup action would be the same action that happened in the event that lead to action_chitchat.