# Rasa Fallback action failing for Faq Bot

**URL:** <https://forum.rasa.com/t/rasa-fallback-action-failing-for-faq-bot/31863>\
**Category:** Rasa Open Source\
**Created:** [July 27, 2020, 7:09am UTC](https://forum.rasa.com/t/rasa-fallback-action-failing-for-faq-bot/31863 "2020-07-27T07:09:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prapends](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@prapends](https://forum.rasa.com/u/prapends)\
**Post date:** [July 27, 2020, 7:09am UTC](https://forum.rasa.com/t/rasa-fallback-action-failing-for-faq-bot/31863/1 "2020-07-27T07:09:37Z")

</div>

Hi , I have developed simple faq bot with rasa using Response selector and It is working fine . But when I implement Fallback Policy in the same and if a user asks anything which is not in the training questions it does not return with the default answer. Instead it gives one answer of faq question. Please let me know how to implement it correctly.

Stories file:

## happy path

- Greet
  - utter\_greet

- faq
  - respond\_faq

- Bye
  - utter\_bye

## Some question from FAQ

- faq
  - respond\_faq

- Bye
  - utter\_bye

## Some random question

- Greet
  - utter\_greet

- faq
  - utter\_default

- Bye
  - utter\_bye

In Responses.md file I have written all the rsponses

# Configuration for Rasa NLU.

# [Components](https://rasa.com/docs/rasa/nlu/components/)

language: en pipeline:

- name: SpacyNLP model: “en\_core\_web\_md”
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer analyzer: “char\_wb” min\_ngram: 1 max\_ngram: 4
- name: DIETClassifier epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector epochs: 200

# Configuration for Rasa Core.

# [Policies](https://rasa.com/docs/rasa/core/policies/)

policies:

- name: TEDPolicy
- name: MemoizationPolicy max\_history: 1
- name: MappingPolicy
- name: FallbackPolicy nlu\_threshold: 0.90 core\_threshold: 0.80

**–Domain File**  
intents:

- Greet
- Bye
- faq

actions:

- respond\_faq
- utter\_greet
- utter\_bye
- utter\_default

responses: utter\_greet:

- text: “Hey! How are you?”

utter\_bye:

- text: “Good bye , Have an Nice Day”

utter\_default:

- text: “Sorry I dont have answer for that.”

session\_config: session\_expiration\_time: 01 carry\_over\_slots\_to\_new\_session: false

Kindly let me know what changes I have to do to have fallback implemented

---

<div class="post-metadata">

**Author:** ![Akhil](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Akhil](https://forum.rasa.com/u/Akhil)\
**Post date:** [July 28, 2020, 12:36am UTC](https://forum.rasa.com/t/rasa-fallback-action-failing-for-faq-bot/31863/2 "2020-07-28T00:36:09Z")

</div>

Hi @prapends. Could you try by increasing the max\_history of MemoizationPolicy to 3 or 5 and see?

---

<div class="post-metadata">

**Author:** ![chkoss](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chkoss/32/7186_2.png) [@chkoss](https://forum.rasa.com/u/chkoss)\
**Post date:** [July 28, 2020, 4:59pm UTC](https://forum.rasa.com/t/rasa-fallback-action-failing-for-faq-bot/31863/3 "2020-07-28T16:59:22Z")

</div>

Hi,

I think the problem is with your stories: In the `happy path` and `some random question`, the intents are exactly the same. So when reaching the `faq` intent, your bot can follow either of those stories, they both match exactly.

What I would recommend is to remove the `some random question` story. Then, whenever the user’s question is confidently classified as `faq` intent, the bot will do `respond_faq`. And whenever the user’s question is too far away from the faq training data (i.e. not much closer to the `faq` examples than to e.g. the `greet` examples) and the nlu confidence falls below 0.90, the bot will fall back (due to the FallbackPolicy) and do `utter_default`.

It is possible that after that you will still have the same problem: If the user question is not in the training data but somewhat similar to the training data (e.g. also starting with “what”), it might still get classified confidently as `faq`.

To prevent this, you can add another intent `out_of_scope` and include a story

```auto
## some random question
* out_of_scope
  - utter_default

```

Then you just need to add some random questions that should not be covered by the faq as examples for the `out_of_scope` intent. Hopefully, random new questions will then be recognised as more similar to the `out_of_scope` than to `faq`. If not, this is not a problem of the policies but of the nlu that doesn’t recognise the correct intent. The best way to solve this is to simply add more training data, or you could also play around with different [Intent Classifiers](https://rasa.com/docs/rasa/nlu/components/#intent-classifiers).

Does this help with your question?

Also, a general tip on how to investigate such issues: To understand what’s going on, it can often be helpful to see the nlu confidence and which policy was used to choose the next action. For that, you can run `rasa shell --debug`. This will show you information like

```auto
DEBUG rasa.core.processor - Received user message 'hi' with intent '{'name': 'greet', 'confidence': 0.9999992847442627}' and entities '[]'

```

and

```auto
DEBUG rasa.core.policies.ensemble - Predicted next action using policy_1_MemoizationPolicy

```

If you have any further questions, let me know!
