Change Required slots on the run

Hi.,

My situation is :

  1. When slot ‘Source’ is Station I need StationName in RequiredSlot

But

  1. When slot ‘Source’ is Train I need TrainNumber in RequiredSlot.

Is it possible to change RequiredSlot dynamically ?

Hi @PalGitts yes, you can do that using if statements in the requested_slots() function, as described here.

Hi Akela,

Problem is most likely users won’t mention whether is it in station or on train in their statement initially. After detection that it is a complaint_intent corresponding register_complaint form is getting invoked and that time Rasa is investigating for RequiredSlots.

As I said the source won’t be in user’s statement so I won’t be able to get it from tracker !

Right, that’s what these if statements are for. You can do a check for if tracker.get_slot("Source") is None: and include Source as a required slot there. And then a few elif statements about the actual value of the Source slot

Hope it helps !