Hi, I’m writing a simple chatbot where it requests the user’s data and fills some slots, similar to the restaurant formbot. The problem is that when I declare a custom slot “firstname” and try to map the extracted PERSON entity from spacy, it only works when firstname is expected (SEE EXAMPLE BELLOW) !
My setup
intents:
- greet: use_entities: []
- goodbye: use_entities: []
- request_data: use_entities: []
entities:
- PERSON
- ORG
- GPE
slots:
firstname:
type: unfeaturized
auto_fill: false
utter_ask_firstname:
- text: “What’s the person’s first name? firstname: {firstname}” utter_slots_values:
- text: “Registered employed with the following parameters firstname: {firstname}”
and story
data input
- request_data
- employee_form
- form{“name”: “employee_form”}
- form{“name”: null}
- utter_slots_values
intent:request_data
actions.py
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
slot_map = {
"firstname": self.from_entity(entity="PERSON"))
}
return slot_map
If I type:
Me: Register
Bot: What’s the person’s first name?
Me: John
Bot: “Registered employed with the following parameters firstname: John”
but if I type
Me: Register John
Bot: “Registered employed with the following parameters firstname: none”
BUT
When I declare the slotname as PERSON, the bot works as expected! It seems that the line slot_map = { “firstname”: self.from_entity(entity=“PERSON”)) }
in order to work as expected, the key in slot_map dict should be an entity already (in our case PERSON)! But this is not practical at all since I want to have one PERSON entity and fill many slots with this value.
This seems like a bug to me! Has anyone run into this?