Slot validation not working in Rasa x

Hi Team,

Greetings!!

Slot validation is not working for me . I am not able to trigger the wrong_utterance for a particular slot. I have referred the various slot examples using form bot and sara bot looks like everything in place. Getting the below error instead.

Failed to extract slot {slot_name} with action requestform

Can someone please pitched into that.

Below is my python code.

I have pasted only for one slot as of now.

def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]: “”“A dictionary to map required slots to - an extracted entity - intent: value pairs - a whole message or a list of them, where a first match will be picked”""

    return {
        "domain": self.from_entity(entity="domain", intent="inform"),
    }

def validate_domain( self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> Optional[Text]: “”“Validate domain value.”""

    if value.upper() in ['SALES','FINANCE','TECH']:
        # validation succeeded, set the value of the "domain" slot to value
        return {"domain": value}
    else:
        dispatcher.utter_template("utter_wrong_domain", tracker)
        # validation failed, set this slot to None, meaning the
        # user will be asked for the slot again
        return {"domain": None}

Can you please provide me some examples wherein slot validation has been configured with Rasa X.

Does the NLU component fetch the right entity? If yes, is the intent of the message ‘inform’? If either one of these dont apply, slot mapping will fail.

@IgNoRaNt23,

As mentioned, Both the things are correct only i.e intent=“inform” and entity=“domain”, still whenever any wrong value is passed to domain one it’s not moving to else part and I am not getting that utter_wrong_domain.

FYI, its working absolutely fine with correct values passed.

Did you try debug statements in your validate method?

Use e.g. logger.debug(f’value of value: {value}’) to see what actually ends up in your validate function (or if you even get there). In order to see the debug statements, you have to add the -vv flag to the run actions command.

Also use debug output to run the bot to see whats going in behind. Id even say that you should run the bot in command line mode and not with Rasa X, since it gives a ton of additional confusing output.

Hi,

Thanks I got the issue and resolved that one.