Rasa Core not following stories.Previous Form is getting executed if its still active

Hi,

Kindly help me with the below scenario. I have 2 intents as “Policy Document” and “Fund Value”. Both the intents are mapped to forms as “action_form_policy_document” and “action_form_fund_value”. I have an entity as policy number which is common for both the forms. Subsequently, there is a slot as policy number.

When I say “I want the policy document for 12345678”, the correct form i.e action_form_policy_document gets invoked and it validates the response and returns that the policy number that I entered is incorrect. Now, instead of correcting my policy number if I say “I want to get the fund value for 00659024” instead of starting the fund value-form, it gives me answer for policy document when it finds the policy number as correct.

The stories are written appropriately for all the use cases. The Story format -

Story Policy Document Authenticated with policy number

  • policy_document{“policy_number”: “09231452”}
    • action_set_custom_intent_name
    • slot{“is_authenticated”: true}
    • form{“name”: null}
    • slot{“requested_slot”: null}
    • action_form_policy_document

Story Fund Value Authenticated with policy number

  • fund_value{“policy_number”: “5436765”}
    • action_set_custom_intent_name
    • slot{“is_authenticated”: true}
    • form{“name”: null}
    • slot{“requested_slot”: null}
    • action_form_fund_value

Below is the server output in debug mode.

Received user message ‘I want to get the fund value for 00659024’ with intent ‘{‘name’: ‘fund_value’, ‘confidence’: 0.961440920829773}’ and entities ‘[{‘start’: 33, ‘end’: 41, ‘value’: ‘00659024’, ‘entity’: ‘policy_number’, ‘confidence’: 0.9886157963650901, ‘extractor’: ‘CRFEntityExtractor’}, {‘start’: 33, ‘end’: 41, ‘text’: ‘00659024’, ‘value’: 659024, ‘confidence’: 1.0, ‘additional_info’: {‘value’: 659024, ‘type’: ‘value’}, ‘entity’: ‘number’, ‘extractor’: ‘DucklingHTTPExtractor’}]’ 2019-09-30 11:26:30 DEBUG rasa.core.processor - Current slot values: continue_confirmation: None custom_intent_name: policy_document dob: 29051972 form_to_resume: None greeted: True group_id: 5cdcee3cf93a651e2325257c is_authenticated: True media_confirmation: None pincode: None policy_number: 00659024 policy_number_list: policy_number_list_for_current_intent: push_media_document_name: None push_media_document_url: None requested_slot: policy_number response_message: None resume_confirmation: None selection_index: [{‘1’: {‘title’: ‘00659024’, ‘payload’: ‘I want my policy document for 00659024’}, ‘2’: {‘title’: ‘01274260’, ‘payload’: ‘I want my policy document for 01274260’}, ‘3’: {‘title’: ‘01297848’, ‘payload’: ‘I want my policy document for 01297848’}, ‘4’: {‘title’: ‘Policy Status’, ‘payload’: ‘policy status’}, ‘5’: {‘title’: ‘Fund Value’, ‘payload’: ‘fund value’}, ‘6’: {‘title’: ‘Premium Paid Certificate’, ‘payload’: ‘premium paid certificate’}, ‘7’: {‘title’: ‘Policy Renewal’, ‘payload’: ‘policy renewal’}, ‘8’: {‘title’: ‘Renewal Premium Receipt’, ‘payload’: ‘premium renewal receipt’}, ‘9’: {‘title’: ‘Unit Statement’, ‘payload’: ‘unit statement’}, ‘10’: {‘title’: ‘D02 Form’, ‘payload’: ‘I want d zeero too form’}, ‘11’: {‘title’: ‘Policy Bond Dispatch’, ‘payload’: ‘Policy Bond Dispatch’}, ‘12’: {‘title’: ‘Nearest Branch’, ‘payload’: ‘nearest branch’}, ‘13’: {‘title’: ‘Contact Us’, ‘payload’: ‘contact us’}, ‘14’: {‘title’: ‘Exit’, ‘payload’: ‘exit’}}] year: None 2019-09-30 11:26:30 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 34 events 2019-09-30 11:26:30 DEBUG rasa.core.policies.memoization - Current tracker state [{‘slot_greeted_0’: 1.0, ‘slot_selection_index_0’: 1.0, ‘slot_greeted_1’: 1.0, ‘slot_custom_intent_name_0’: 1.0, ‘slot_is_authenticated_0’: 1.0}, {‘entity_number’: 1.0, ‘slot_group_id_0’: 1.0, ‘slot_policy_number_0’: 1.0, ‘entity_policy_number’: 1.0, ‘intent_policy_document’: 1.0, ‘slot_greeted_0’: 1.0, ‘slot_selection_index_0’: 1.0, ‘prev_action_listen’: 1.0, ‘slot_greeted_1’: 1.0, ‘slot_custom_intent_name_0’: 1.0, ‘slot_is_authenticated_0’: 1.0}, {‘slot_policy_number_0’: 1.0, ‘intent_policy_document’: 1.0, ‘prev_action_set_custom_intent_name’: 1.0, ‘slot_policy_number_list_0’: 1.0, ‘slot_policy_number_list_for_current_intent_0’: 1.0, ‘entity_policy_number’: 1.0, ‘slot_greeted_0’: 1.0, ‘slot_dob_0’: 1.0, ‘slot_selection_index_0’: 1.0, ‘slot_custom_intent_name_0’: 1.0, ‘entity_number’: 1.0, ‘slot_group_id_0’: 1.0, ‘slot_greeted_1’: 1.0, ‘slot_is_authenticated_1’: 1.0, ‘slot_is_authenticated_0’: 1.0}] 2019-09-30 11:26:30 DEBUG rasa.core.policies.memoization - Launch DeLorean… 2019-09-30 11:26:30 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, {‘slot_is_authenticated_0’: 1.0, ‘slot_greeted_0’: 1.0}] 2019-09-30 11:26:30 DEBUG rasa.core.policies.memoization - There is a memorised next action ‘0’ 2019-09-30 11:26:30 DEBUG rasa.core.policies.two_stage_fallback - NLU confidence threshold met, confidence of fallback action set to core threshold (0.5). 2019-09-30 11:26:30 DEBUG rasa.core.policies.form_policy - There is an active form ‘action_form_policy_document’ 2019-09-30 11:26:30 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy 2019-09-30 11:26:30 DEBUG rasa.core.processor - Predicted next action ‘action_form_policy_document’ with confidence 1.00. 2019-09-30 11:26:30 DEBUG rasa.core.actions.action - Calling action endpoint to run action ‘action_form_policy_document’

I understand we can deactivate the form, but in my current scenario where will I deactivate it?

Thanks.

hi @Simran - welcome back to the forum! You shouldn’t have to deactivate it manually, once the form has everything it needs and the submit method is run, the form will no longer be active.

Hi Alan, Thank you for taking time to go through the problem and posting a solution. However, my concern is different.

We are trying to implement “intent chaining” and “intent resume”. In doing so, this is the first problem we have encountered while letting a user switch/jump from the one intent to another. Allow me to rephrase the problem statement again.

  1. I have two intents namely “Policy Document” and “Fund Value”.
  2. Both the intents need a slot named “policy_number” for fulfillment.
  3. Now, when I start the first intent i.e “Policy Document”, it asks me for “policy number” through the form.
  4. However, instead of providing the policy number, I enter the utterance for the second intent by saying “I want to get the fund value for 00659024”.
  5. Rasa NLU correctly predicts the intent as “Fund Value” and entity as “Policy Number” in the above utterance.
  6. However, instead of switching to “Fund Value” intent, Rasa continues with the first intent i.e “Policy Document” and fulfills it with the “Policy Number” provided.

Thanks, Simran.

hi @Simran - sounds like your form should be rejecting that utterance because it’s not valid input for the form. At that point, the form should reject it and you should have a story for what do to (easiest to create this via interactive learning).

check out Forms to read about validation and slot mappings

Hello Alan,

I was able to resolve this by restricting slot mapping in forms. Thanks for the help.