You can do custom extraction and validation of slot values by writing custom actions in three different ways.
You can use the
action_validate_slot_mappings action to define custom extraction and / or validation of slots that
can be set or updated outside of a form context.
This action is called automatically at the end of the default action
so the name must not be changed. If you are using Rasa SDK, you should extend the Rasa SDK
If you are using a different action server, you will need to implement an action class with equivalent functionality to
the Rasa SDK class. Please see the action server docs for details.
With this option, you do not need to specify the
action key in the custom slot mapping,
since the default action
automatically if present in the
actions section of the domain.
Custom actions named
validate_<form name> will run automatically if the form it specifies in its name is activated.
If you are using Rasa SDK, the custom action should inherit from the Rasa SDK
If you are not using Rasa SDK, you will need to implement an action or action class with equivalent functionality to the
FormValidationClass in your custom action server. Please see the action server docs for details.
Regular Custom Action
You can use a regular custom action custom action that returns
events for custom slot extraction. Use this option if neither
validate_<form name> meet your needs.
For example, if you want to reuse the same custom action explicitly in a story or rule, you should use a regular custom
action for custom slot extraction.
A slot validation action should only return
Any other event type will be filtered out by the default action
The name of the custom action must be specified in the
action key of the relevant custom slot mapping
in the domain.
Note that the action name must be listed in the domain
actions section too.