Form Validation Not Running for Requested Slots

Hi there, I have a form running that passes validation when I only require 2 slots, but when I require more I’m seeing that the follow-up questions for requested slots are not getting triggered.

I have followed the formbot pattern in the rasa examples folder.

Here is a dump of my actions server logs:

2019-06-11 16:28:46 DEBUG rasa_sdk.forms - Extracted ‘iphone’ for extra slot ‘product’ 2019-06-11 16:28:46 DEBUG rasa_sdk.forms - Extracted ‘broken’ for extra slot ‘condition’ 2019-06-11 16:28:46 DEBUG rasa_sdk.forms - Validating extracted slots: {‘product’: ‘iphone’, ‘condition’: ‘broken’} 2019-06-11 16:28:46 DEBUG rasa_sdk.forms - Request next slot ‘action’ 2019-06-11 16:28:46 DEBUG rasa_sdk.executor - Finished running ‘product_form’

Here is the validation in actions.py:

@staticmethod
def action_db() -> List[Text]:
    return ["return", "support"]

def validate_action(
    self,
    value: Text,
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> Any:

    if value.lower() in self.action_db():
        return {"action": value}
    else:
        dispatcher.utter_template("utter_wrong_action", tracker)
    return {"action": None}

And here is the shell, where I’d expect the followup question to appear:

(base) base ❯ rasa shell -v 
/Users/a1451195/anaconda3/lib/python3.7/site-packages/dask/config.py:168: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
 data = yaml.load(f.read()) or {}
 2019-06-11 16:28:37 INFO     root  - Starting Rasa Core server on http://localhost:5005
Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input ->  hi
Thank you for choosing X Support, my name is Wendy. How may I assist you today?
Your input ->  my iphone is broken
Your input ->

Thanks for any help you can provide

UPDATE: I came across one undodumented property of the forms object, that depends on adding something like this to your domain.yml

   utter_wrong_condition:
     - text: What condition is the product in?

This utter_wrong_{slot} pattern allows the form to respond when it needs the slot filled, but it is still not extracting the slot after I respond.

Also, I now see that the vaildate_{slot} method in your actions class (in actions.py) is only run when the slot is filled, not when it is empty.

What I’m still struggling with is how to fill slots that are empty on the first pass.

Hi @jabberlope

could you please uncomment the following part in the validate - method:

raise ActionExecutionRejection(
                            self.name(),
                            "Failed to extract slot {0} "
                            "with action {1}"
                            "".format(slot_to_fill, self.name()),
                        )

and instead add

return []

and check again what the form does?

Regards

UPDATE 2: I was able to get the slots to validate in the form by removing the auto_fill: false from the slot objects.

From ->

  condition:
    type: unfeaturized
    auto_fill: false

To ->

  condition:
    type: unfeaturized
1 Like

I’ve seen the validate method in the rasa_sdk, is that what you’re talking about?

None of the bot examples include a validate method in their Form Class.

It was put in the FormAction parent class. You could just overwrite it in the derived class or quickly change it in the FormAction class.

Maybe I faced a similar issue - that’s why I am asking.

I’m not having that issue anymore now that I’ve removed the auto_fill property off the slot.