Preventing other forms to be predicted when there is an active form

Problem:

The main functionality we wish to achieve is to finish the execution of a form until the end even if other intents are predicted in between. Eg: When “Find a doctor” form is active and the requested_next slot has “PERSON” as the slot, if the user types “cancer” we want to assume the user is looking for “cancer doctor”. But currently “cancer” as stand alone is trained as another FormAction. How can we avoid form and action switching when a current form is active?

Conversation: The conversation as generated in Rasa X

  • skill_type_find_practitioner_by_name

    • practitioner_name_form

    • form{“name”:“practitioner_name_form”}

    • slot{“requested_slot”:“PERSON”}

  • search_medical_service{“medical_speciality”:“Cancer”}

    • medical_service_form

    • form{“name”:null}

    • slot{“requested_slot”:null}

    • medical_service_form

    • form{“name”:“medical_service_form”}

    • slot{“medical_speciality”:“cancer”}

    • form{“name”:null}

    • slot{“requested_slot”:null}

    • action_slot_reset

When an active form “Practitioner_name_form” and user gives input “cancer” rasa detects search_medical_service(which is correct) intent then the bot changes to another form “medical_service_form”, I want it to stay in the first form Practitioner_name_form activated.

We also made sure our slot filling takes care of using any text entered by the user to solve our use-case but the problem is Rasa core model is not sending the action to currently active form Practitioner_name_form

Logs: While looking at the model server logs :

The model predicts another action using mapping policy, is there any way this can be avoided and the conversation to continue in a form once its activated irrespective of the intent predicted later.

Config File:

Below is the config file I’m using for the model: language: en

    pipeline: 

      - name: SpacyNLP 

      - name: SpacyTokenizer 

      - name: RegexFeaturizer 

      - name: LexicalSyntacticFeaturizer 

      - name: CountVectorsFeaturizer 

      - name: CountVectorsFeaturizer 

        analyzer: "char_wb" 

        min_ngram: 1 

        max_ngram: 4 

      - name: DIETClassifier 

        epochs: 100 

        random_seed: 42 

      - name: EntitySynonymMapper 

      - name: ResponseSelector 

        epochs: 100 

    policies: 

      - name: FormPolicy 

      - name: MemoizationPolicy 

      - name: MappingPolicy 

      - name: TEDPolicy 

        max_history: 5 

        epochs: 100 

      - name: "FallbackPolicy" 

        nlu_threshold: 0.4 

        core_threshold: 0.3 

        fallback_action_name: "action_out_of_scope" 

The Domain file:

These are the intent mappings for the forms: intents:

- goodbye: 

    triggers: utter_goodbye 

- affirm 

- deny 

- mood_great 

- mood_unhappy 

- inform 

- facility_type 

- location 

- event_name 

- appreciate 

- get_debug_info: 

    triggers: show_debug_info 

- skill_type_find_facility: 

    triggers: facility_form 

- skill_type_find_practitioner: 

    triggers: practitioner_form 

- skill_type_find_practitioner_by_name: 

    triggers: practitioner_name_form 

- skill_type_find_event_name: 

    triggers: event_form 

- skill_type_find_medical_service: 

    triggers: medical_service_form 

- search_facility: 

    triggers: facility_form 

- search_contact_sanford: 

    triggers: show_contact_sanford 

- search_virtual_visit: 

    triggers: show_virtual_visit 

- search_myhealth: 

    triggers: show_myhealth 

- search_covid_resources: 

    triggers: show_covid_resources 

- search_symptom: 

    triggers: show_symptom_response 

- search_disease: 

    triggers: show_symptom_response 

- search_practitioner: 

    triggers: practitioner_form 

- search_practitioner_name: 

    triggers: practitioner_name_form 

- search_medical_service: 

    triggers: medical_service_form

It sounds like you could have some expected intent confusion in the middle of your form. You should be very careful about the examples you provide in these two intents and consider using a TwoStageFallback policy to handle low confidence scores.

I also suggest you simplifies your form stories as we show here. Let the form handle the slot request details instead of the story. Add a happy path and another with the example you discussed if the incorrect cancer intent is predicted in the middle of your find a doctor form.

Greg

@va1shn9v handle this behavior in the validation function of the form action through code instead of the stories so that validation function doesn’t raise action execution rejection exception.