Weird behaviour in Stories

I have a story that looks like this:

# doubt flow - painel options
* has_doubt
    - utter_has_doubt
* enter_data{"doubts_options": "Painel"}
    - utter_painel_options
* enter_data{"painel_options": "Ativação do painel"}
    - utter_painel_activation_options
> check_painel_activation

## doubt flow - activation painel - option A
> check_painel_activation
* enter_data{"button_options": "A"}
    - utter_painel_activation_link
> check_finish_up

## doubt flow - activation painel - option B
> check_painel_activation
* enter_data{"button_options": "B"}
    - utter_painel_activation_how
> check_finish_up

## doubt flow - activation painel - option C
> check_painel_activation
* enter_data{"button_options": "C"}
    - utter_painel_activation_not_able
> check_finish_up

Everything works fine until users gets to check_painel_activation. In there it looks like Rasa ignores the entity. The button_options entity is declared at domain file. Also it is working right identifying it in NLU. As you can see:

Received user message 'A' with intent '{'name': 'enter_data', 'confidence': 0.9505975842475891}' and entities '[{'start': 0, 'end': 1, 'value': 'A', 'entity': 'button_options', 'confidence': 0.7102413205981658, 'extractor': 'ner_crf'}]'

But for some reason it goes to the wrong part of the story.

rasa_core.policies.memoization  - There is no memorised next action
rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
rasa_core.processor  - Predicted next action 'utter_painel_activation_not_able' with prob 0.31.

Why it doesn’t know that it has to go to: ## doubt flow - activation painel - option A ?

I even tried to write a different story instead of using checkpoints I made like this:

## doubt flow - painel options with A
* has_doubt
    - utter_has_doubt
* enter_data{"doubts_options": "Painel"}
    - utter_painel_options
* enter_data{"painel_options": "Ativação do painel"}
    - utter_painel_activation_options
* enter_data{"button_options": "A"}
    - utter_painel_activation_link
> check_finish_up

## doubt flow - painel options with B
* has_doubt
    - utter_has_doubt
* enter_data{"doubts_options": "Painel"}
    - utter_painel_options
* enter_data{"painel_options": "Ativação do painel"}
    - utter_painel_activation_options
* enter_data{"button_options": "B"}
    - utter_painel_activation_how
> check_finish_up

## doubt flow - painel options with C
* has_doubt
    - utter_has_doubt
* enter_data{"doubts_options": "Painel"}
    - utter_painel_options
* enter_data{"painel_options": "Ativação do painel"}
    - utter_painel_activation_options
* enter_data{"button_options": "C"}
    - utter_painel_activation_not_able
> check_finish_up

And I get the same problem. Although it recognizes the button_options entity it goes to the wrong part of the story. When the value is A it goes to B for example.

Regards, Leonardo

Ah I think I got it. That’s because you cannot make a conditional through stories? You can just put a sample of the entity there but you cannot really say that needs to be that one? So we need to use an action to perform the conditional?

is the slot button_options categorical?

button_options is not a slot it is an intent.

it seems like a slot

I meant entity not intent, sorry. Entities are written the same way as slots in the story isn’t? Is there a different way to write it?

Ps.: the entity is defined in the NLU and is also allowed in the domain

I solved the issue by making an Action but it would be much easier to do it in stories if that’s possible.

Is it possible to make stories conditional to entities? Or that’s possible only with intents?

You can make it conditional if you add them as slots and slots which are of type categorical

Button_options should be stored as slots after extracted as an entity. If it is extracted from NLU then simply name the slot button_options

Make sure the type is categorical Check rasa documentation