Filling slots based on pervioes slots

rasa-core

(Hossa95) #1

I am making a bot for cars … lets say i have 3 slots to take from user (Make, Model, Year)

but if I take for example the Model from user I want to fill the Make slot manually by some value and don’t ask the user for it How can I do this?

I tried this approach in the required_slots():

if tracker.get_slot('carYear'):
    SlotSet('Make', "value")
    return ["Make", "Model", "Year"] 

but the Make slot isn’t filled and the bot asks for it… any better ideas?


(Srikar) #2

You have to return the SlotSet method in the function for the slot to get set.

if tracker.get_slot('carYear'):
    return [SlotSet('Make', "value")]

(Hossa95) #3

but this function should return the required slots not SlotSet()?


(Srikar) #4

Oh sorry, I interpreted your question in a wrong way.

Anyway, you can only set the value of a slot by returning it. What if you remove the Model slot from required slots and maybe fill that slot later in a custom action?


(Hossa95) #5

looks like a nice approach … but you recommend fill it in the validation function?


(Srikar) #6

Yea, you can try that out too. That way you won’t have to trigger another action, it should be possible to fill in in the validate method.