Custom Action is not predicted when FormAction is active

I have multiple FormActions which belong to different story types. Both FormActions need similar inputs with a couple exceptions.

The first requested field (with conditional slot logic) is the email address of the user, which needs to be

  1. validated by checking if in DB
  2. if valid, it is used to retrieve some other information from the DB and set slots accordingly. This is needed to get confirmation from the user before executing the FormAction

Now, I tried adding a function to the class that I could use in the validate() function within the FormAction class, similarly as here. But returning the SlotSet event did not change the slots I need to modify (guess because it is within the class). Therefore, I created a custom validation action, that is added to the stories when the email slot is set:

* provideemail{"email": "example@example.no"}
    - slot{"email": "example@example.no"}
    - action_validateEmail

This action also returns the followup action to be the active FormAction if any is active, or chooses the followup action according to story. This seems to be great because multiple forms need this validation, and if I force the path in online training, the conversation is exactly what I need, it just doesn’t get predicted. It also works without error in online training when the the FormAction is not yet active (e.g. email address is given before request that initiates FormAction.

The problem is that when the FormAction is already activated, once the email address is entered by the user, the validation action never gets predicted. It is always the FormAction that keeps being predicted.

Is there any way to get around this? My ideas and problems:

  1. Adding the validation inside the FormAction - cannot set other slots that are required to carry out the form. These are not retrieved from the user, but need to be returned to them before finishing form action

  2. The above solution with the external validation - not getting predicted

Please let me know if you have any ideas what could be a get around!

If you did not change the default config, rasa core will first use memory prediction policy, if it failed, then the Keras policy. It is hard to find out the reason Keras make an incorrect prediction. Maybe you can add more training data.

Thanks for the answer.

I ended up modifying everything a bit, and adding a FormAction deactivation whenever the validation Action hasn’t been executed yet (or not successfully).

Then the bot carries on and reactivates the relevant form according to stories.