How to include **Fallback Policy** in Configuration , domain and action files?

I want to display some custom message to users who ask out of questions other than what I given. To do that I want to include Fallback Policy but I’m getting error please can you show the correct code how should I include it in Configuration, domain and action files.

I have also gone through the document but it doesn’t work for me so can you please explain it.

Hi @skjainmiah,

there are several possibilities to achieve this. The most straight forward would be:

- name: FallbackPolicy
   nlu_threshold: 0.45
   ambiguity_threshold: 0.1
   core_threshold: 0.3
   fallback_action_name: 'utter_default_fallback' 

where utter_default_fallback_ represents a defined response in your domain.yml. Simply add that to your config.yml to make things work. Is you can read here, keep in mind that you have to modify the thresholds to your needs. The fallback_action_name can be a represented response or a custom action, registered in your domain.yml, e.g. if you want to the fallback not just utter something.

Did that help?

Kind regards

1 Like

What type of error your getting? I have included fall back details in the config.yml file, it’s working for me. Please check your domain file once and re-train the mode…

Ex Domain file:- language: en pipeline: supervised_embeddings policies:

  • name: MemoizationPolicy max_history: 3
  • name: KerasPolicy
  • name: MappingPolicy
  • name: FormPolicy
  • name: FallbackPolicy nlu_threshold: 0.4 core_threshold: 0.3 fallback_action_name: action_fallback

that worked fine thanks. Is there a way to make bot to search on google and get back those results to user in chat?