Hi Rasa community,
I am using rasa 2.6
and have two distinct forms feedback_loop
and semantic_search_loop
I loop onto over multiple times:
feedback_loop:
required_slots:
1_proposed_matrixes:
- intent: affirm
type: from_intent
value: yes
2_proposed_domains:
- intent: affirm
type: from_intent
value: yes
3_precontent:
- intent: affirm
type: from_intent
value: yes
4_content:
- intent: affirm
type: from_intent
value: yes
- intent: deny
type: from_intent
value: no
5_intro_quiz:
- intent: affirm
type: from_intent
value: yes
6_quiz:
- intent: affirm
type: from_intent
value: yes
- intent: deny
type: from_intent
value: no
7_feedback:
- intent: affirm
type: from_intent
value: yes
8_improvement:
- type: from_text
semantic_search_loop:
required_slots:
1_ss_content_or_search:
- intent: search
type: from_intent
value: yes
- intent: content
type: from_intent
value: no
3_ss_query:
- type: from_text
4_ss_results:
- intent: affirm
type: from_intent
value: yes
- intent: ss_nok
type: from_intent
value: no
5_ss_precontent:
- intent: affirm
type: from_intent
value: yes
6_ss_content:
- intent: affirm
type: from_intent
value: yes
7_ss_quiz:
- intent: affirm
type: from_intent
value: yes
- intent: deny
type: from_intent
value: no
8_ss_feedback:
- intent: affirm
type: from_intent
value: yes
9_ss_improvement:
- type: from_text
I have dedicated rules to activate and submit those two forms:
- rule: Activate feedback_loop form when no other form is active
condition:
# this condition allows stories to handle form switching
- active_loop: null
steps:
- action: action_content_or_search
- intent: content
- action: feedback_loop
- active_loop: feedback_loop
- rule: Activate semantic_search_loop form when no other form is active
condition:
# this condition allows stories to handle form switching
- active_loop: null
steps:
- action: action_content_or_search
- intent: search
- action: semantic_search_loop
- active_loop: semantic_search_loop
- rule: Submit feedback_loop form
condition:
- active_loop: feedback_loop
steps:
- action: feedback_loop
- active_loop: null # indicates form is completed
- action: action_next_session
- rule: Submit semantic_search_loop form
condition:
- active_loop: semantic_search_loop
steps:
- action: semantic_search_loop
- active_loop: null # indicates form is completed
- action: action_next_session
These loops work well. However, when semantic_search_loop
form is active I would like to definitely quit this form when intent /content
is encountered, reset all its required slots and activate directly the feedback_loop
form. I tried to do this with inspiration from financial-demo bot and @ChrisRahme by defining this story:
- story: Activate semantic_search_loop form + switch to feedback_loop form
steps:
- intent: search
- action: semantic_search_loop
- active_loop: semantic_search_loop
- intent: content
- action: action_deactivate_loop
- active_loop: null # indicates form is completed
- action: feedback_loop
- active_loop: feedback_loop
But, when I run the bot and encounter the /content
intent during the semantic_search_loop
form when filling the first required slot 1_ss_content_or_search
, the bot ask for the next required slot 3_ss_query
instead of following the story defined by quitting the semantic_search_loop
form and activating the feedback_loop
form…
Please find below the detailed debug log when inputting /content intent during the semantic_search_loop
form:
? Voulez-vous faire une recherche ou choisir une formation ? 2: Choix de formation (/content)
2022-05-12 15:28:52 DEBUG rasa.core.lock_store - Issuing ticket for conversation 'c9019120dcbe4c2cbd0804673808343d'.
2022-05-12 15:28:52 DEBUG rasa.core.lock_store - Acquiring lock for conversation 'c9019120dcbe4c2cbd0804673808343d'.
2022-05-12 15:28:52 DEBUG rasa.core.lock_store - Acquired lock for conversation 'c9019120dcbe4c2cbd0804673808343d'.
2022-05-12 15:28:52 DEBUG rasa.core.tracker_store - Recreating tracker for id 'c9019120dcbe4c2cbd0804673808343d'
2022-05-12 15:28:52 DEBUG rasa.core.processor - Received user message '/content' with intent '{'name': 'content', 'confidence': 1.0}' and entities '[]'
2022-05-12 15:28:52 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 99 events.
2022-05-12 15:28:52 DEBUG rasa.core.policies.memoization - Current tracker state:
[state 1] user intent: content | previous action name: action_listen | active loop: {'name': 'semantic_search_loop'}
2022-05-12 15:28:52 DEBUG rasa.core.policies.memoization - There is no memorised next action
2022-05-12 15:28:52 DEBUG rasa.core.policies.ted_policy - TED predicted 'action_deactivate_loop' based on user intent.
2022-05-12 15:28:52 DEBUG rasa.core.policies.rule_policy - Current tracker state:
[state 1] user intent: greet | previous action name: action_listen
[state 2] user intent: greet | previous action name: action_welcome
[state 3] user intent: greet | previous action name: action_motivation
[state 4] user intent: affirm | previous action name: action_listen
[state 5] user intent: affirm | previous action name: action_intro_culture_num
[state 6] user intent: affirm | previous action name: action_listen
[state 7] user intent: affirm | previous action name: action_culture_num
[state 8] user intent: affirm | previous action name: action_content_or_search
[state 9] user intent: search | previous action name: action_listen
[state 10] user intent: search | previous action name: semantic_search_loop | active loop: {'name': 'semantic_search_loop'}
[state 11] user text: /content | previous action name: action_listen | active loop: {'name': 'semantic_search_loop'}
2022-05-12 15:28:52 DEBUG rasa.core.policies.rule_policy - There is no applicable rule.
2022-05-12 15:28:52 DEBUG rasa.core.policies.rule_policy - Predicted loop 'semantic_search_loop'.
2022-05-12 15:28:52 DEBUG rasa.core.policies.ensemble - Made prediction using user intent.
2022-05-12 15:28:52 DEBUG rasa.core.policies.ensemble - Added `DefinePrevUserUtteredFeaturization(False)` event.
2022-05-12 15:28:52 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_2_RulePolicy.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Predicted next action 'semantic_search_loop' with confidence 1.00.
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Validating user input 'UserUttered(text: /content, intent: content, use_text_for_featurization: False)'.
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Trying to extract requested slot '1_ss_content_or_search' ...
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Got mapping '{'intent': 'search', 'type': 'from_intent', 'value': 'yes'}'
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Got mapping '{'intent': 'content', 'type': 'from_intent', 'value': 'no'}'
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Successfully extracted 'no' for requested slot '1_ss_content_or_search'
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Validating extracted slots: {'1_ss_content_or_search': 'no'}
2022-05-12 15:28:52 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'validate_semantic_search_loop'.
2022-05-12 15:28:52 DEBUG rasa.core.actions.forms - Request next slot '3_ss_query'
2022-05-12 15:28:52 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'action_ask_semantic_search_loop_3_ss_query'.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7effc015f370>]'.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Action 'semantic_search_loop' ended with events '[<rasa.shared.core.events.SlotSet object at 0x7effc0111580>, <rasa.shared.core.events.SlotSet object at 0x7effc0111fa0>, BotUttered('Que voulez-vous rechercher ?', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {}, 1652362132.8105752)]'.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Current slot values:
1_proposed_matrixes: None
2_proposed_domains: None
3_precontent: None
4_content: None
5_intro_quiz: None
6_quiz: None
7_feedback: None
8_improvement: None
counter_improvement: 2
counter_content: 1
id_matrix: None
id_domain: None
id_answer: 323281
list_ids_answer: None
id_feedback: resp1
id_quiz: 12272
1_ss_content_or_search: no
2_ss_switch: None
3_ss_query: None
4_ss_results: None
5_ss_precontent: None
6_ss_content: None
7_ss_quiz: None
8_ss_feedback: None
9_ss_improvement: None
ss_id_content: 12398
ss_buttons: [{'payload': '/affirm{"ss_id_content": "6711"}', 'title': '#La complexité de l’environnement : focus sur les aspects culturels [40sec - Article]\nCulture et ouverture - Des éléments à prendre en compte dans le leadership.'}, {'payload': '/affirm{"ss_id_content": "12345"}', 'title': "#Qu'est-ce qu'être un leader ? L'ABC du leadership [10min20 - Video]\nConfiance, vision, motivation - Voici comment passer du pouvoir au leadership."}, {'payload': '/affirm{"ss_id_content": "6690"}', 'title': "#L’approche transformationnelle\ndu leadership [2min30 - Article]\nL'approche transformationnelle - \u200bIl n'y a pas que le leader qui compte."}, {'payload': '/affirm{"ss_id_content": "12918"}', 'title': '#Leadership et influence [8min28 - Video]\nOn ne naît pas leader, on le devient - Évoluer de bon manager à bon leader.'}, {'payload': '/affirm{"ss_id_content": "12398"}', 'title': '#Leadership et influence [8min28 - Video]\nOn ne naît pas leader, on le devient - Évoluer de bon manager à bon leader.'}, {'payload': '/ss_nok', 'title': 'Pas satisfait'}]
ss_switch_to_content: None
requested_slot: 3_ss_query
session_started_metadata: None
2022-05-12 15:28:52 DEBUG rasa.core.policies.memoization - Current tracker state:
2022-05-12 15:28:52 DEBUG rasa.core.policies.memoization - There is a memorised next action 'action_listen'
2022-05-12 15:28:52 DEBUG rasa.core.policies.ted_policy - TED predicted 'action_listen' based on user intent.
2022-05-12 15:28:52 DEBUG rasa.core.policies.rule_policy - Predicted 'action_listen' after loop 'semantic_search_loop'.
2022-05-12 15:28:52 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_2_RulePolicy.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Predicted next action 'action_listen' with confidence 1.00.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Policy prediction ended with events '[]'.
2022-05-12 15:28:52 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'.
2022-05-12 15:28:52 DEBUG rasa.core.lock_store - Deleted lock for conversation 'c9019120dcbe4c2cbd0804673808343d'.
Que voulez-vous rechercher ?
Does anyone would have an idea ?
Many thanks!