Is it possible to set slots within validation action

I have two entity extractors which can both return a value so I get [“John”, “John Smith”]. I choose SlotSet(“name”, John Smith") and dispatcher.utter_message(response=“utter_person_found”). This response contains the contents of the entity but still shows the list of both.

I could hardcode it in the validation action but would prefer to have it in responses to enable easy translation to multiple languages. So how can I set the slot directly?

I’m not sure I understand. Your title says you want to set the slot from the validation action, but your message says you want to do so inside the domain?

The validate_slotname() method in a FormValidationAction is made specifically for setting slots. You can set slots other than the one mentioned in the method’s name! Look at this example:

async def validate_password(value, dispatcher, tracker, domain):
    if not tracker.get_slot('loggedin'):
        username = tracker.get_slot('username')
        password = value

        db = DatabaseConnection()
        count = db.query(f'SELECT COUNT(*) FROM user_info WHERE Username = {username} AND Password = {password}')

        if count == 1:
             dispatcher.utter_message(f'You are now logged in as {username}.')
            return {'password': 'secret', 'loggedin': True}
        else:
            dispatcher.utter_message(f'Sorry, you entered an incorrect password for {username}.')
            return {'password': None, 'loggedin': False}

    else: # Already logged in
        username = tracker.get_slot('username').title()
        dispatcher.utter_message(f'You are already logged in as {username}.')
        return {'username': username, 'password': 'secret', 'loggedin': True}

Within validation action I can utter a message as a string but would be better to keep all strings in the domain file.

If the string is in the domain file “hello I am {name}” then name is filled by the slot name. The value of slot name is [“john smith”, “john”] from two separate NER models. I want to set name=“John Smith” and for this to be displayed by the domain file message. Not sure this is possible as there does not seem to be any way to set slots within python code for validate.