Story Path Based on Slot Filled

Hi!

This could be a really simple question, but I’ve been scouring the forums for the past hour and can’t seem to find anything.

How can I use the existence of slot values to determine story paths? For example, I want to ask the user what time they’d like to book an appointment. If a date/time can be extracted from their next message – great. Continue with a confirmation message. Otherwise, ask them again to get a valid date/time.

I’m using Duckling to extract dates/times, so I have a custom action set up to fill the “time” slot, sort of like this:

time = next(tracker.get_latest_entity_values("time"), None)
return [SlotSet("time", time)]

…but I’m not sure how to handle cases where time == None.

I’d like my bot to respond with something like “Sorry, I didn’t understand that, what time would you like to have your appointment?” and then try to extract the date/time from the next message.

But for a “happy path”, that doesn’t need to happen, and we can continue to a confirmation message. This is the “happy path” I have now:

## affirmation path
* greet
  - utter_intro
* affirm
  - utter_availability
* propose_time
  - action_extract_time
  - utter_confirm

Is there some way I can tell this story to check if the time slot is or is not None, and then either ask again or utter the confirmation depending on the result?

Thank you!

Check out rasa forms.

Fill slot using the time entity. It will go ahead with the happy path only when said slot gets filled.

Thanks so much! I switched over to Rasa forms and it’s making things a lot simpler now. I appreciate the help!