Handling stories for same intent multiple times

Hi., I am building a legal assistant chat bot. Let’s assume in a situation where client is clearing her mundane doubts with questions like ‘what is a bail’, ‘how much hiring a lawyer cost?’ or ‘how to file a divorce’ then these queries do not fall under any predefined intents but nlu_fallback.

My question is how to handle the repetitive sequence of [ nlu_fallback → action_handle_fallback ]+ (+ indicates 1 or more occurrence in Regex ) scenarios in story.yml ?

nlu_fallback

Hi, I’m not entirely sure what you mean by

repetitive sequence of [ nlu_fallback → action_handle_fallback ]+ (+ indicates 1 or more occurrence in Regex ) scenarios

If the goal is to just tell the user “We’re not able to handle that question”, then define an out_of_scope intent with all the examples you gave, and add a regular rule or story:

rules:
- rule: out-of-scope
  steps:
  - intent: out_of_scope
  - action: utter_out_of_scope

(See: https://rasa.com/docs/rasa/fallback-handoff#handling-out-of-scope-messages)

If the goal is to handle all these mundane messages with a single intent: how about defining a single intent mundane_questions which groups all of these mundane questions?

Then you could then handle the regex in a couple of ways:

# With entities
# One story per entity
- story: Mundane question 1
  steps:
    - intent: mundane_questions
      entities:
        - some_entity_1: some_value_1
    - action: utter_answer_mundane_question_1
- story: Mundane question 2
  steps:
    - intent: mundane_questions
      entities:
        - some_entity_2: some_value_2
    - action: utter_answer_mundane_question_2
# Etc

or with an action

- story: All mundane questions
  steps:
    - intent: mundane_questions
    - action: handle_all_mundane_questions_with_code_which_deals_with_regex

That would leave you the possibility to use nlu_fallback for something else.

If you really want to use the fallback mechanism, it’s possible to do something similar to the out_of_scope suggestion, again by writing a custom action (see: https://rasa.com/docs/rasa/fallback-handoff#nlu-fallback)

Hope that helps