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.