Understand the mapping between intents, slots and actions


Please correct me if I am wrong. As far as I understand, rasa determines the next action based on the intent, slots (whether it is filled or not) and previous actions.

Let’s take an example of a bot which answers questions of any given country. E.g: “What is the GDP of India in 2017?”, “What was the life expectancy in Germany in 2001?” etc. In this case, we have 1 intent (“ask_value”), 4 entities and corresponding slots (“time”, “country”, “economy_metric”, “health_metric”) and 2 actions (“action_economy_metric_value”, “action_health_metric_value”).

Conversation flow:

  1. “What is the GDP of India in 2017?” intent = “ask_value” slots filled = “time”, “country”, “economy_metric” next action = “action_economy_metric_value”
  2. “What was the life expectancy in Germany in 2001?” intent = “ask_value” slots filled = “time”, “country”, “economy_metric”, “health_metric”

The problem is that the “economy_metric” slot was filled because of the 1st question and remains filled. Rasa sees that both “economy_metric” and “health_metric” slots are filled and gets confused while deciding the next action. If “economy_metric” slot wasn’t filled, it could have easily decided that the next action is “action_health_metric_value”.

Am I missing something here? If not, how do we deal with this situation?

Cheers, Achinta

I have a simple solution for you.

return [AllSlotsReset()]

Use this in both of your custom action’s return statement.

Thanks for the reply Virendra. This would solve the problem but it will create a new one. I want the bot to remember common slots like time and country. E.g:

  1. “What is the GDP of India in 2017?”
  2. “What is its average income?”
  3. “What was the life expectancy in 2001?”

I want the bot to remember that country=India and the time=2017 for 2nd question and country=India in Q3. AllSlotsReset() will clear all the previous information.

One solution (which I have implemented in-house) is to have two classes of entities (and slots): common slots and specific slots. The former won’t be cleared after every question and the latter will be cleared after every question.

I was wondering whether there is a better solution. I believe that this a good feature to have in rasa_core.

as far as i can understand you want specific slots to reset rather than clearing up all slots for that you can do this in your custom action code

return [SlotSet(‘slot name’,None)]

with this you can reset individual slots to null

1 Like

I am using the solution you mentioned but I was hoping to find a better solution. Thanks!