Why doesn't this slot_mapping work?

In my domain, I specified:

    type: unfeaturized
    type: unfeaturized
    type: unfeaturized
    type: unfeaturized

Then in my actions.py, I defined: def slot_mappings(self): return {“num_1”: self.from_entity(entity=“num”, intent=“caculate”), “num_2”: self.from_entity(entity=“num”, intent=“caculate”)}

‘num’ is entity recognized correctly by the intent ‘caculate’. However, when I run it, it reports: 2019-06-26 19:53:35 INFO rasa_sdk.interfaces - Tried to access non existent slot ‘num_1’ 2019-06-26 19:53:35 INFO rasa_sdk.interfaces - Tried to access non existent slot ‘num_2’

According to the documentation, it says custom mapped slot should also be specified in stories. However, how to specify it? The current examples all are categorical or bool values, so that it can specify the slot as a dictionary.However, in my case, the “num_1” and “num_2” are two numbers used in a caculator, whose values are unknown, and can’t be specified beforehand.

My story looks like: ## caculate * caculate - action_caculate

Should I include the slots below “action_caculate”? If yes, what’s the correct format?

Hi @twittmin

are you using a FormAction or a CustomAction?

As documented here:

you are able to to something like:

# calculate 
* calculate {"num_1": "59376"}
  - slot{"num_1": "59376"}
  - action_caculate

Try to retrain your model with a story like this and see if it helps!


@JulianGerhard, it’s a subclass of Action, not intended for FormAction.

Do you mean the ‘59376’ can be an arbitrary number for the training?

Hi @twittmin

if it is derived from Action, then you should be able to use my story suggestion.

The 59376 is just an arbitrary sample that tells the story, that it should/could expect not only a triggered intent rather than an intent and an entity. If you mention “5555” instead in your utterance, then the slot would be filled accordingly.

Does that answer you question?

Yes. Thank you, @JulianGerhard. Could you also take a look at my other question regarding “forgetting” entity history for each new utterance?

Do you have experience in dealing with this situation? It seems a common need. Thank you.