RASA 2.0 slot mappings


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:

- 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?

Hi @fabrice-toussaint

I can share with you what I would do.

In domain.yml I write this:

    - 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(
    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!!! :smiley:


No problem. Glad it works again. :+1: