how to decide which slot to be filled at a time? How to have control over slot filling?
eg: need to collect details for a hotel room booking, slots are hotel name, person name There is a hotel name “Hotel Michael” (synonym: michael), and if the chatbot asks for the hotel name and user types “Michael” it will be extracted as enity hotel_name and PERSON. Thereby filling two slots at the same time.
I tried collecting details through two different form, but it didn’t work, in both forms, both slots are filled at the same time (and i am not sure if i am doing it right)
I am really grateful for your response, I also have one another doubt, the slot values are rest to None after all slots of a form are filled, but i want the slot values to persist.
I haven’t wrote any code for custom slot mapping yet, the only actions i am running right now is to utter prompt questions(or some texts) for filling slot of a form
I saw this on the custom slot mapping documentation " Make sure that in the domain file you list for your form only those slots that use predefined mappings."
so I removed hotel_name from my form hotel_booking_form, Now the form doesn’t ask the prompt question.
Since i extended FormValidationAction class i am getting this error Skipping validation for hotelname: there is no validation method specified. Earlier entity and slot was having name now, the entity is hotel_name and slot is hotelname
This is how I coded custom slot mapping, is this the right way to do it?
I am facing one other problem. I have a Synonym mapper that maps [“Michael”, “Hotel Michael”, “Hotel Michael, New York”, “Hotel Michael NYC”] into “Hotel Michael”, So if someone enters their name “Michael” it is transformed into “Hotel Michael” and stored in the PERSON slot.
You need to write either an Utterance or Custom Action named utter_ask_slotname or action_ask_slotname respectively (See Ask For the Next Slot).
To validate the slot, you need to implement the validate_slotname method in the class and return an output of {"slotname": slotvalue} (See Validating Form Input).
I do have a custom action to ask for prompt
class AskForSlotHotelName(Action):
def name(self) → Text:
return “action_ask_hotelname”
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
dispatcher.utter_message(text="There are beautiful hotels in Sentosa.")
dispatcher.utter_message(text="Which hotel are you looking for?")
hotel_list = list(hotel_info.keys())
dispatcher.utter_message(text= f" We provide booking for {', '.join(hotel_list[:-1])} and {hotel_list[-1]}")
return []
i resolved the issue by using name = next(tracker.get_latest_entity_values("hotel_name"),None)
still the form is not asking the prompt to enter the hotel name, I do have a custom action to ask for prompt class AskForSlotHotelName(Action)
My doubt is how will the form knows to utter for a prompt if the slot is not mentioned inside the form (Forms 2nd point)
thank you @ChrisRahme i understand my mistake, I should add hotelname at the beginning of the required_slot, instead of appending it to the end of required_slot list.
i have a doubt @ChrisRahme , if we are using extract_slotname(), then do we have to write another slot validation code to validate slot value? validation can also be done in extract_slotname() method itself, right?
I have a entity conflict between DIETClassifiier and SpacyEntityExtractor, and when I use next(tracker.get_latest_entity_values("hotel_name"),None) I get the next entity value from the generator object, Is there a way I can choose the extractor
Is there a way we could decide among the results of different entity extractor?
tracker.get_latest_entity_values() is a python generator object, right? we iterate over it using next().
regarding validation during extracting is that the right way to do? I thought of making the chatbot faster by validating during extraction, But I am not sure if it would cause trouble in some corner condition.