There is no memorised next action

Hello community,

I have been dealing with a quite frustrating bug for the last few days, and I wonder if there’s a way around this. I am running the following versions of rasa-python

Rasa Version      :         3.4.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.4.0
Python Version    :         3.9.7
Operating System  :         Linux-5.4.0-136-generic-x86_64-with-glibc2.27
Python Path       :         /home/kosmas/workspace/rasatest/venv/bin/python3.9

I have implemented this simple example in this repo (branch master, not main). The problem is that the Memoization Policy isn’t working with categorical slots. I have been trying to implement a simple story branching scenario based on the value of a categorical slot:

  • Hi!
  • Hey! First of all, do you pay in cash or with a card?
  • card
  • So you will pay in card. Forwarding you to our agent.

or

  • Hi
  • Hey! First of all, do you pay in cash or with a card?
  • cash
  • Sorry, but our service doesn’t accept cash for the moment…

The corresponding stories are no-brainers, as you can see in the stories file. I have defined the slot and the mapping from entity in the usual way, as you can see in the domain file. Slot filling is by entity in declare_payment_type (nlu here). However, I can’t get the Memoization policy to work when the user sets the slot with their response:

- Received user message 'cash' with intent '{'name': 'declare_payment_type', 'confidence': 0.9999998807907104}' and entities '[{'entity': 'payment_type', 'start': 0, 'end': 4, 'confidence_entity': 0.9985716342926025, 'value': 'cash', 'extractor': 'DIETClassifier'}]'
2023-01-16 18:27:22 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-16 18:27:22 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 9 events.
2023-01-16 18:27:22 DEBUG    rasa.core.actions.action  - Validating extracted slots: payment_type
2023-01-16 18:27:22 DEBUG    rasa.core.processor  - Default action 'action_extract_slots' was executed, resulting in 1 events: SlotSet()
2023-01-16 18:27:22 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7fc2b85f5fd0>}, targets: ['select_prediction'] and ExecutionContext(model_id='1865f84a74a34d1e9a58e5357953df5a', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-16 18:27:22 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-16 18:27:22 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-16 18:27:22 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-16 18:27:22 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: greet | previous action name: action_listen | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 2] user intent: greet | previous action name: utter_greet | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 3] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: action_listen | slots: {'payment_type': (0.0, 0.0, 1.0, 0.0)}
2023-01-16 18:27:22 DEBUG    rasa.core.policies.memoization  - There is no memorised next action

I really want to make this work with Memoization, so I can experiment with the TED policy for the more complex scenarios and use the memoization for the simpler cases.

Hey there, I am having the exact same problem. I have some basic stories and wanted to check how memoization and TED policies work, so I run rasa shell with debug flag, and although I followed the stories exactly, the prediction was made using TED policy and not memoization. I would appreciate it if someone explained why this would possibly happen.

1 Like
  • Your main branch has only the README.md with no other files. I reviewed the master branch.
  • The two stories you link to on the master branch related to the card paths start with greet but your example debug doesn’t start with greet & utter_greet. This could be why TED is used
  • I suggest you drop the greet & utter_greet from those stories.

Thank you for responding!

  1. I couldn’t merge the two branches then, but now I set the default branch to master. Apologies for the inconvenience
  2. The debug I quoted is showing the reponse to the second user utterance, where memoisation fails. Here is the full debug from the beginning of the story:
2023-01-30 13:54:44 DEBUG    rasa.core.lock_store  - Issuing ticket for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:44 DEBUG    rasa.core.lock_store  - Acquiring lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:44 DEBUG    rasa.core.lock_store  - Acquired lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:44 DEBUG    rasa.core.tracker_store  - Could not find tracker for conversation ID 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Starting a new session for conversation ID 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Action 'action_session_start' ended with events '[<rasa.shared.core.events.SessionStarted object at 0x7f4bd0816490>, ActionExecuted(action: action_listen, policy: None, confidence: None)]'.
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-30 13:54:44 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__message__': [<rasa.core.channels.channel.UserMessage object at 0x7f4bd2046280>]}, targets: ['run_RegexMessageHandler'] and ExecutionContext(model_id='a1333cdd82ba49c09448caea89ab4d5b', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'nlu_message_converter' running 'NLUMessageConverter.convert_user_message'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_WhitespaceTokenizer0' running 'WhitespaceTokenizer.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_RegexFeaturizer1' running 'RegexFeaturizer.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_LexicalSyntacticFeaturizer2' running 'LexicalSyntacticFeaturizer.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_CountVectorsFeaturizer3' running 'CountVectorsFeaturizer.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_DIETClassifier4' running 'DIETClassifier.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_EntitySynonymMapper5' running 'EntitySynonymMapper.process'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_RegexMessageHandler' running 'RegexMessageHandler.process'.
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Received user message 'Hi' with intent '{'name': 'greet', 'confidence': 0.9999943971633911}' and entities '[]'
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 4 events.
2023-01-30 13:54:44 DEBUG    rasa.core.actions.action  - Validating extracted slots: 
2023-01-30 13:54:44 DEBUG    rasa.core.processor  - Default action 'action_extract_slots' was executed, resulting in 0 events: 
2023-01-30 13:54:44 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4bd20aea90>}, targets: ['select_prediction'] and ExecutionContext(model_id='a1333cdd82ba49c09448caea89ab4d5b', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 13:54:44 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: greet | previous action name: action_listen | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
2023-01-30 13:54:44 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'utter_greet'
2023-01-30 13:54:44 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_extract_slots' based on user intent.
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ensemble  - Made prediction using user intent.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ensemble  - Added `DefinePrevUserUtteredFeaturization(False)` event.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ensemble  - Predicted next action using MemoizationPolicy.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Predicted next action 'utter_greet' with confidence 1.00.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7f4bd0c27760>]'.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Action 'utter_greet' ended with events '[BotUttered('Hey! First of all, do you pay in cash or with a card?', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {"utter_action": "utter_greet"}, 1675079685.0024543)]'.
2023-01-30 13:54:45 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4bd20aea90>}, targets: ['select_prediction'] and ExecutionContext(model_id='a1333cdd82ba49c09448caea89ab4d5b', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: greet | previous action name: action_listen | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 2] user intent: greet | previous action name: utter_greet | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
2023-01-30 13:54:45 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'action_listen'
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_extract_slots' based on user intent.
2023-01-30 13:54:45 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 13:54:45 DEBUG    rasa.core.policies.ensemble  - Predicted next action using MemoizationPolicy.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 13:54:45 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'.
2023-01-30 13:54:45 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:46 DEBUG    rasa.core.lock_store  - Issuing ticket for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:46 DEBUG    rasa.core.lock_store  - Acquiring lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:46 DEBUG    rasa.core.lock_store  - Acquired lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.
2023-01-30 13:54:46 DEBUG    rasa.core.tracker_store  - Recreating tracker for id 'e259994c-a094-11ed-ac79-90b11ca66549'
2023-01-30 13:54:46 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__message__': [<rasa.core.channels.channel.UserMessage object at 0x7f4bd20aea90>]}, targets: ['run_RegexMessageHandler'] and ExecutionContext(model_id='a1333cdd82ba49c09448caea89ab4d5b', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'nlu_message_converter' running 'NLUMessageConverter.convert_user_message'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_WhitespaceTokenizer0' running 'WhitespaceTokenizer.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_RegexFeaturizer1' running 'RegexFeaturizer.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_LexicalSyntacticFeaturizer2' running 'LexicalSyntacticFeaturizer.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_CountVectorsFeaturizer3' running 'CountVectorsFeaturizer.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_DIETClassifier4' running 'DIETClassifier.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_EntitySynonymMapper5' running 'EntitySynonymMapper.process'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_RegexMessageHandler' running 'RegexMessageHandler.process'.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Received user message 'card' with intent '{'name': 'declare_payment_type', 'confidence': 0.9999872446060181}' and entities '[{'entity': 'payment_type', 'start': 0, 'end': 4, 'confidence_entity': 0.9937981963157654, 'value': 'card', 'extractor': 'DIETClassifier'}]'
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 9 events.
2023-01-30 13:54:46 DEBUG    rasa.core.actions.action  - Validating extracted slots: payment_type
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Default action 'action_extract_slots' was executed, resulting in 1 events: SlotSet()
2023-01-30 13:54:46 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4bd0816430>}, targets: ['select_prediction'] and ExecutionContext(model_id='a1333cdd82ba49c09448caea89ab4d5b', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 13:54:46 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: greet | previous action name: action_listen | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 2] user intent: greet | previous action name: utter_greet | slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 3] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: action_listen | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
2023-01-30 13:54:46 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 13:54:46 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_back' based on user intent.
2023-01-30 13:54:46 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 13:54:46 DEBUG    rasa.core.policies.ensemble  - Made prediction using user intent.
2023-01-30 13:54:46 DEBUG    rasa.core.policies.ensemble  - Added `DefinePrevUserUtteredFeaturization(False)` event.
2023-01-30 13:54:46 DEBUG    rasa.core.policies.ensemble  - Predicted next action using TEDPolicy.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Predicted next action 'action_back' with confidence 0.07.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7f4bd20b7700>]'.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Action 'action_back' ended with events '[<rasa.shared.core.events.UserUtteranceReverted object at 0x7f4bd0816c10>, <rasa.shared.core.events.UserUtteranceReverted object at 0x7f4bf80d2730>]'.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 13:54:46 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'.
2023-01-30 13:54:46 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'e259994c-a094-11ed-ac79-90b11ca66549'.

Following your last suggestion, I added stories without the “greet” part. (I commited them to this branch).

I ran only the second step:

  • User: I’d like to pay with card
  • Bot: So you will pay in card. Forwarding you to our agent. Bye

But this is predicted with TED, not memoization policy. Here are the logs of the conversation.

2023-01-30 14:07:28 DEBUG    rasa.core.lock_store  - Issuing ticket for conversation '9832666c-a096-11ed-ac79-90b11ca66549'.
2023-01-30 14:07:28 DEBUG    rasa.core.lock_store  - Acquiring lock for conversation '9832666c-a096-11ed-ac79-90b11ca66549'.
2023-01-30 14:07:28 DEBUG    rasa.core.lock_store  - Acquired lock for conversation '9832666c-a096-11ed-ac79-90b11ca66549'.
2023-01-30 14:07:28 DEBUG    rasa.core.tracker_store  - Could not find tracker for conversation ID '9832666c-a096-11ed-ac79-90b11ca66549'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Starting a new session for conversation ID '9832666c-a096-11ed-ac79-90b11ca66549'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Action 'action_session_start' ended with events '[<rasa.shared.core.events.SessionStarted object at 0x7f4b3cc0dee0>, ActionExecuted(action: action_listen, policy: None, confidence: None)]'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-30 14:07:28 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__message__': [<rasa.core.channels.channel.UserMessage object at 0x7f4bc9f67400>]}, targets: ['run_RegexMessageHandler'] and ExecutionContext(model_id='d0c555d7fba54006b0e1f0d8209dcc21', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'nlu_message_converter' running 'NLUMessageConverter.convert_user_message'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_WhitespaceTokenizer0' running 'WhitespaceTokenizer.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_RegexFeaturizer1' running 'RegexFeaturizer.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_LexicalSyntacticFeaturizer2' running 'LexicalSyntacticFeaturizer.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_CountVectorsFeaturizer3' running 'CountVectorsFeaturizer.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_DIETClassifier4' running 'DIETClassifier.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_EntitySynonymMapper5' running 'EntitySynonymMapper.process'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_RegexMessageHandler' running 'RegexMessageHandler.process'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Received user message 'Pay with card' with intent '{'name': 'declare_payment_type', 'confidence': 0.9999959468841553}' and entities '[{'entity': 'payment_type', 'start': 9, 'end': 13, 'confidence_entity': 0.9969891905784607, 'value': 'card', 'extractor': 'DIETClassifier'}]'
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Current slot values: 
	payment_type: empty
	session_started_metadata: None
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 4 events.
2023-01-30 14:07:28 DEBUG    rasa.core.actions.action  - Validating extracted slots: payment_type
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Default action 'action_extract_slots' was executed, resulting in 1 events: SlotSet()
2023-01-30 14:07:28 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4b3c2ba6d0>}, targets: ['select_prediction'] and ExecutionContext(model_id='d0c555d7fba54006b0e1f0d8209dcc21', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: action_listen | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'utter_repeat_payment_method' based on user intent.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ensemble  - Made prediction using user intent.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ensemble  - Added `DefinePrevUserUtteredFeaturization(False)` event.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ensemble  - Predicted next action using TEDPolicy.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Predicted next action 'utter_repeat_payment_method' with confidence 0.06.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7f4b604446d0>]'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Action 'utter_repeat_payment_method' ended with events '[BotUttered('So you will pay in card. Forwarding you to our agent.', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {"utter_action": "utter_repeat_payment_method"}, 1675080448.56062)]'.
2023-01-30 14:07:28 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4b3c2ba6d0>}, targets: ['select_prediction'] and ExecutionContext(model_id='d0c555d7fba54006b0e1f0d8209dcc21', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: action_listen | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
[state 2] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: utter_repeat_payment_method | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'utter_goodbye' based on user intent.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ensemble  - Predicted next action using TEDPolicy.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Predicted next action 'utter_goodbye' with confidence 0.07.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Action 'utter_goodbye' ended with events '[BotUttered('Bye', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {"utter_action": "utter_goodbye"}, 1675080448.5682297)]'.
2023-01-30 14:07:28 DEBUG    rasa.engine.runner.dask  - Running graph with inputs: {'__tracker__': <rasa.shared.core.trackers.DialogueStateTracker object at 0x7f4b3c2ba6d0>}, targets: ['select_prediction'] and ExecutionContext(model_id='d0c555d7fba54006b0e1f0d8209dcc21', should_add_diagnostic_data=False, is_finetuning=False, node_name=None).
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'rule_only_data_provider' running 'RuleOnlyDataProvider.provide'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'domain_provider' running 'DomainProvider.provide_inference'.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_MemoizationPolicy0' running 'MemoizationPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] slots: {'payment_type': (1.0, 0.0, 0.0, 0.0)}
[state 1] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: action_listen | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
[state 2] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: utter_repeat_payment_method | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
[state 3] user intent: declare_payment_type | user entities: ('payment_type',) | previous action name: utter_goodbye | slots: {'payment_type': (0.0, 1.0, 0.0, 0.0)}
2023-01-30 14:07:28 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'run_TEDPolicy1' running 'TEDPolicy.predict_action_probabilities'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_listen' based on user intent.
2023-01-30 14:07:28 DEBUG    rasa.engine.graph  - Node 'select_prediction' running 'DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs'.
2023-01-30 14:07:28 DEBUG    rasa.core.policies.ensemble  - Predicted next action using TEDPolicy.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 0.07.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2023-01-30 14:07:28 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'.
2023-01-30 14:07:28 DEBUG    rasa.core.lock_store  - Deleted lock for conversation '9832666c-a096-11ed-ac79-90b11ca66549'.

Hey @kosniaz , you’re missing

actions:
- utter_goodbye
- utter_greet
- utter_we_dont_accept_cash

in the domain and because of this the featurization doesn’t go as expected. Add these and you should be good to go. I’ve tried locally and it works for me. Let me know if it works for you as well.

Regards, Nikola

P.S.

Actually, this won’t be enough and I forgot that I’ve added another thing as well. And that is the following:

  - slot_was_set:
    - payment_type: empty

at the start of each story. Because of this, stories.yml looks like this now:

version: "3.1"

stories:

- story: happy path card
  steps:
  - slot_was_set:
    - payment_type: empty
  - intent: greet
  - action: utter_greet
  - intent: declare_payment_type
    entities:
      - payment_type: card
  - slot_was_set:
    - payment_type: card
  - action: utter_repeat_payment_method
  - action: utter_goodbye

- story: happy path cash
  steps:
  - slot_was_set:
    - payment_type: empty
  - intent: greet
  - action: utter_greet
  - intent: declare_payment_type
    entities:
      - payment_type: cash
  - slot_was_set:
    - payment_type: cash
  - action: utter_we_dont_accept_cash
  - action: utter_goodbye

- story: goodbye
  steps:
  - slot_was_set:
    - payment_type: empty
  - intent: goodbye
  - action: utter_goodbye

If you can confirm that it works like this on your side, it seems to me we could file a bug/issue to Rasa’s GitHub.

Hello Nikola,

thanks for the input. It seems to me that the problem is still here. I’m sorry for the delay in responding. I will come back soon with the branch I made the changes to suggest, so that you can see that the problem persists.

Thank you,

Kosmas

Hi Kosmas,

no problem at all. I took the time to fork your repo and apply changes that made it work for me. Please clone the repo GitHub - NikolaMr/rasa-bugs-demo: Trying to demonstrate some bugs in the [Rasa Framework](https://github.com/RasaHQ/rasa), change the branch to no-memorized-action-fix and give it a try.

Btw, how were you debugging things? I’ve used rasa interactive --debug command for that. It is really useful when debugging model issues.

Regards, Nikola

1 Like

Hi Nikola,

Thanks so much for this solution! It appears that the necessary steps are:

  1. To set an initial (empty) value of the slots corresponding to the entities that cause the stories to branch
  2. To specify that the slots have the initial value at the beginning of each story, as in the following:
- story: happy path card
  steps:
  - slot_was_set:
    - payment_type: empty
  - intent: greet
  - action: utter_greet
  - intent: declare_payment_type

3 To declare the entities found inside the user utterance, under the intent, as in this code

- intent: declare_payment_type
  entities:
       - payment_type : cash

Finally the stories look like this:

- story: happy path card
  steps:
  - slot_was_set:
    - payment_type: empty
  - intent: greet
  - action: utter_greet
  - intent: declare_payment_type
    entities:
    - payment_type: card
  - slot_was_set:
    - payment_type: card
  - action: utter_repeat_payment_method
  - action: utter_goodbye

and the slots/entities look like this in the domain file:

slots:
  payment_type:
    type: categorical
    influence_conversation: true
    mappings:
    - type: from_entity
      entity: payment_type
      not_intent: goodbye
    initial_value: empty
    values:
    - empty
    - card
    - cash

entities:
 - payment_type

I didn’t think it was necessary to add the entities field under the user intent where the branching happens.

Also maybe it’s not necessary to have the slot’s initial value in the start of the story, but I will test this out tomorrow and come back here.

Thanks once more,

Have a great day!

Kosmas

Hi @kosniaz I’m glad it proved helpful. Happy to help :slight_smile:

In one of the prior Rasa versions, there was this issue with initial values being required at the start of the story so it seems to be the case still.

Regarding the entities inside the intent, this is related to newer Rasa versions where slot values are not automatically mapped from same-named entities so I guess that would be the reason why entities need to be included in the stories while previously they weren’t required.

Have a great day! Nikola

1 Like

It also works without setting an initial value

I guess it’s bad practice, but I have to report that it’s not necessary to define an initial value for the slot in order for the memoization policy to work. You just have to add two lines at the beginning of all stories:

  - slot_was_set:
    - payment_type: null

and, as stated above, set the recognized entities and values as well as the extracted slot values whenever present.

Extra question

Does that mean that, every time we need to add a story to be used by memoization policy, we need to add all possible values of entities? For example, what if we have a goodbye intent and an entity that may appear in the user speech, e.g. swearword?