No, the first intent in the first story (search_application{"service":"applicationdate", "degree":"masters"
}) means something different than you think. It doesn’t mean "The degree
slot is set to "masters"
, the service
slot is set to "applicationdate"
and the user sends a message with intent search_application
". Instead, it means "The user sends a message with intent search_application
that includes a service
entity with value "applicationdate"
and a degree
entity with value "masters"
. So this story will only cover a situation where the user message includes both, e.g. “What’s the application date for a masters degree?”
A story that covers the situation you want is one where the slot is first set and then later used, e.g.
* search_application{“service”:“some_other_service”}
- utter_ask_degree
* inform_application{“degree”:“masters”}
- slot{“degree”:“masters”}
- ...whatever else the other service sets or does
* search_application{“service”:“applicationdate”}
- action_application
- slot{“date”:“October 11st”}
This becomes trickier though if a lot of conversation can happen between the slot being set and used - you might have to write lots of different stories… Instead of manually writing those stories, you can also use Interactive Learning to teach your bot how to behave in those situations.
An alternative solution (probably easier and nicer) is this:
Use a Form with required_slots
service and degree. A form will only ask for those required slots that aren’t filled yet. So a story
* search_application{"service":"applicationdate"}
- application_form
- form{"name": "application_form"}
- form{"name": null}
- action_application
- slot{"date":"October 11th"}
should cover all cases now. The form will make sure all slots are filled (= do nothing if the slots are already set, ask for the degree if the degree slot is not set yet), and then in your custom action action_application
you can pick the date depending on the value of tracker.get_slot("degree")
.
Note that for this to work, the slots in the form need to have type unfeaturized
. This means they won’t affect the prediction of the next action, which in this case is fine: no matter what the degree is, the bot should always run the form first to ask for all unfilled slots and then run action_application
.
Sorry for the long text. I recommend you try the solution with the form, and let me know if you run into any more questions or issues.