I have noticed that the entities and slots that have the same name can only fill slots. For example: If I want to fill a location slot, I must have an entity named location as well, even when there exists other slots like cities and towns that also require location entity. I want to know the workaround to use only 1 entity for 3 slots. I want to use location entity to fill slots cities and towns as well.
I don’t think rather has a native solution for this yet, but you can write a custom action which copies the general slot into the more specific one, like this:
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet
class SourceAirportAction(Action):
def name(self):
# type: () -> Text
return "source_airport_action"
def run(self, dispatcher, tracker, domain):
city = tracker.get_slot('location')
return [SlotSet("city", city)]
I solved it by using FormAction slot_mappings instead. Thanks!