SlotSet vs retrun{slot_name: value}

Hello everyone,

I would like to ask, what is the difference between the return[SlotSet(slot_name, value)] and the return{"slot_name":value}?

I was taking them as similar but I am not sure if this is correct.

@EvanMath Nice question.

return[SlotSet(slot_name, value)]

This means: set slots to extracted values Ref: rasa.shared.core.events

return{"slot_name":value}

This means: validation method, to validate the slots, where you want to return {<slot_name>, value} if validation succeeds else print an error message and return {<slot_name>, None}. Ref: Forms

I hope this will clear your doubt and solve your topic post. Good Luck!

Hey @nik202 , thnks again for your reply. So in this case

the slot is already been set and we just say it’s ok to use this value otherwise change it to “None” and print an error message? This command it could follow the SlotSet.

@EvanMath this I guess you can used for validation; please check the suggested link, what you asked I suggested you the same.

For example:

 if slot_value.lower() in self.cuisine_db():
            # validation succeeded, set the value of the "cuisine" slot to value
            return {"cuisine": slot_value}
        else:
            # validation failed, set this slot to None so that the
            # user will be asked for the slot again
            return {"cuisine": None}

I have gone through all these links. I think we are saying the same thing here. Anyway, thank you.

@EvanMath Your are welcome :handshake:, please close this thread as a solution for others and Good Luck!