Is it possible to create a custom slot mapping for slots that are not required by a form? More specifically, I have a form with 2 required slots and custom slot mappings for each of them (because the predefined mappings i.e. from_entity, from_intent, from_trigger_intent and from_text, do not fit my use-case). However, I also have other entities that I extract that are not required in order to respond to a query, but if the user does provide the information I would like to store it. These entities would also require a custom slot mapping.
The Rasa docs clearly state how to create a custom slot mapping for slots my form will request, but it is not clear how to create a custom slot mapping for any additional non-required slots.
Example:
I need two pieces of information in order to answer the question, domain and information_need. However, if the user provides a distance (e.g. 1000 meters), I would like to store that too, even though it’s not required to respond to the query. Below is an example of what my current code looks like in actions.py.
class ValidateTestForm(FormValidationAction):
def name(self) -> Text:
return "validate_test_form"
async def required_slots(
self,
slots_mapped_in_domain: List[Text],
dispatcher: "CollectingDispatcher",
tracker: "Tracker",
domain: "DomainDict",
) -> Optional[List[Text]]:
return ["domain", "information_need"]
async def extract_domain(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> Dict[Text, Any]:
#custom code to extract domain slot
async def extract_information_need(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> Dict[Text, Any]:
#custom code to extract information need slot
I am wondering where to put my custom extraction code for a third slot (distance) without having to make the slot required by the test form. Please let me know if I need to clarify any further.