I’m excited to use 2.0, and have a question about required slots and using conditional logic.
I use a lot of logic in my required_slots
methods in my forms that change what is required based on the user’s answers. Here’s an example:
def required_slots(tracker: Tracker) -> List[Text]:
if (tracker.get_slot("fatal_sql_error") is None ):
requiredSlot = ["fatal_sql_error", "attempt_to_register"]
return requiredSlot
elif (tracker.get_slot("fatal_sql_error") == "No" ):
print("collect error / ticket")
if (tracker.get_slot("attach_screenshot",) is None):
requiredSlot = ["attach_screenshot","error_message"]
return requiredSlot
else:
return []
else:
if (tracker.get_slot("attempt_to_register") is None):
requiredSlot = ["attempt_to_register"]
return requiredSlot
elif (tracker.get_slot("attempt_to_register") == "No"):
requiredSlot = ["logged_in_60_days"]
return requiredSlot
else:
if (tracker.get_slot("need_help_changing_password") is None):
requiredSlot = ["need_help_changing_password"]
return requiredSlot
elif (tracker.get_slot("need_help_changing_password") == "No"):
return []
else:
requiredSlot = ["afloat_resolved"]
return requiredSlot
I’m not sure I see how I can mimic that logic with the new .yml
format in the forms:
section mentioned here - Forms
Is that type of logic possible with 2.0? or do you have any other suggestions?