Hello,
I have a question regarding slot mappings. For example, I can map a slot to a specific intent and I can list the intents to include but I cannot attach values to these intents.
For example, I have two intents: affirm and decline and want to map True and False as values, example:
product_damaged_slot:
- type: from_intent
value: [true, false]
intent: [affirm, decline]
The returned value is then a list instead of either True or False. How can I take care of this?
Johan1us
(Johan)
October 28, 2020, 2:13pm
2
Hi @fabrice-toussaint
I can share with you what I would do.
In domain.yml I write this:
product_damaged_slot:
- type: from_intent
intent: affirm
value: yes
- type: from_intent
intent: deny
value: no
Then I make a custom action in actions.py
async def validate_product_damage_slot(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
"""Validates value of product_damage_slot"""
if value in ["yes", "no"]:
return {"product_damage_slot": value}
return {"product_damage_slot": None}
I hope it helps.
I am an idiot, I did not think about doing it that way. Thanks a lot @Johan1us , it is fixed now!!!
Johan1us
(Johan)
October 28, 2020, 5:19pm
4
@fabrice-toussaint
No problem. Glad it works again.