Form does not respect required_slots(tracker) condition

Hi everyone !

I made a simple form asking the user:

  • His name (NAME)
  • If the icecream is for him or an other person (binary button format) (PERSON)
  • His preffered flavour (FLAVOUR)

Using required_slots(tracker) I conditionally said that if the icecream is for another person then a new button slot called (PERSON_CONCERNED) should be answered before telling the bot his favourite flavour.

Here is a look at my formaction:

class ActionFormInfo(FormAction):

def name(self) -> Text:

    return "icecream_form"

@staticmethod

def required_slots(tracker) -> List[Text]:

    if tracker.get_slot('PERSON') == "other person":

        return ["NAME", "PERSON", "PERSON_CONCERNED", "FLAVOUR"]

    else:

        return ["NAME", "PERSON", "FLAVOUR"]

The problem is that my slot “PERSON_CONCERNED” is not taken into consideration when I run my form with rasa shell.

Looking forward to hear your feedback :slight_smile:

Bob

hi @small_bob, one question, is ‘PERSON’ definitely filled before the form is run? Or can it be filled during the form?

Hi Melinda !

I solved the problem.

Their was a small typo in the form action preventing it from being recognized.

Best,

Bob