Hi; I’m trying to create an appointment bot in RASA where I use Spacy’s entity extractor to detect values like dates and times. For example,
"Book an appointment" => fires book_appointment intent
"Book an appointment for tomorrow" => fires book_appointment intent + fills entity DATE
"Book an appointment for tomorrow at 3 PM" => fires book_appointment intent + fills entity DATE + fills entity TIME
The entities are getting detected just fine, and I’ve specified each entity and their values in my actions.py file as well:
class AppointmentForm(FormAction):
def name(self):
return "appointment_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]: return [
"appointment_date", "appointment_time", "client_name", "client_phone"]
def slot_mappings(self):
return {
"appointment_date": [self.from_entity(entity="DATE")],
"appointment_time": [self.from_entity(entity="TIME")],
"client_name": [self.from_text()],
"client_phone": [self.from_text()],
}
def submit(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
return []
However, the bot is still asking me for a date (utter_ask_appointment_date
) even when an input specifies the entities mentioned above. Here is the bot running with --debug:
Your input -> book an appointment for tomorrow at 3 PM
2020-01-28 20:37:18 DEBUG rasa.core.tracker_store - Creating a new tracker for id 'default'.
2020-01-28 20:37:18 DEBUG rasa.core.processor - Starting a new session for conversation ID 'default'.
2020-01-28 20:37:18 DEBUG rasa.core.processor - Action 'action_session_start' ended with events '[<rasa.core.events.SessionStarted object at 0x00000164DFE72FC8>, <rasa.core.events.ActionExecuted object at 0x00000164DFE72A48>]'.
2020-01-28 20:37:18 DEBUG rasa.core.processor - Current slot values:
appointment_date: None
appointment_time: None
client_name: None
client_phone: None
requested_slot: None
2020-01-28 20:37:18 DEBUG rasa.core.processor - Received user message 'book an appointment for tomorrow at 3 PM' with intent '{'name': 'book_appointment', 'confidence': 0.9226344343217546}' and entities '[{'entity': 'DATE', 'value': 'tomorrow', 'start': 24, 'confidence': None, 'end': 32, 'extractor': 'SpacyEntityExtractor'}, {'entity': 'TIME', 'value': '3 PM', 'start': 36, 'confidence': None, 'end': 40, 'extractor': 'SpacyEntityExtractor'}]'
2020-01-28 20:37:18 DEBUG rasa.core.processor - Current slot values:
appointment_date: None
appointment_time: None
client_name: None
client_phone: None
requested_slot: None
2020-01-28 20:37:18 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 4 events.
2020-01-28 20:37:18 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'entity_DATE': 1.0, 'entity_TIME': 1.0, 'prev_action_listen': 1.0}]
2020-01-28 20:37:18 DEBUG rasa.core.policies.memoization - There is no memorised next action
2020-01-28 20:37:19 DEBUG rasa.core.policies.form_policy - There is no active form
2020-01-28 20:37:19 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_1_KerasPolicy
2020-01-28 20:37:19 DEBUG rasa.core.processor - Predicted next action 'appointment_form' with confidence 0.16.
2020-01-28 20:37:19 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'appointment_form'.
2020-01-28 20:37:21 DEBUG rasa.core.processor - Action 'appointment_form' ended with events '[BotUttered('What date?', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {}, 1580224041.1129706), <rasa.core.events.Form object at 0x00000164E0FE8908>, <rasa.core.events.SlotSet object at 0x00000164E0FE8A88>]'.
2020-01-28 20:37:21 DEBUG rasa.core.processor - Current slot values:
appointment_date: None
appointment_time: None
client_name: None
client_phone: None
requested_slot: appointment_date
2020-01-28 20:37:21 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_book_appointment': 1.0, 'entity_DATE': 1.0, 'entity_TIME': 1.0, 'prev_action_listen': 1.0}]
2020-01-28 20:37:21 DEBUG rasa.core.policies.memoization - There is no memorised next action
2020-01-28 20:37:21 DEBUG rasa.core.policies.mapping_policy - There is no mapped action for the predicted intent, 'book_appointment'.
2020-01-28 20:37:21 DEBUG rasa.core.policies.form_policy - There is an active form 'appointment_form'
2020-01-28 20:37:21 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2020-01-28 20:37:21 DEBUG rasa.core.processor - Predicted next action 'action_listen' with confidence 1.00.
2020-01-28 20:37:21 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'.
2020-01-28 20:37:21 DEBUG rasa.core.lock_store - Deleted lock for conversation 'default'.
What date?
Your input ->
I have no idea why RASA refuses to fill in the slot for appointment_date
or appointment_time
despite the entities being detected and being specifically told to fill in using said entities.
Please help.