Getting error while adding default fallback action

I have added default fallback for inputs not matching my handled intents. But I am getting trace back when I give such inputs.

Traceback (most recent call last): File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py”, line 2292, in wsgi_app response = self.full_dispatch_request() File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py”, line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask_cors\extension.py”, line 161, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py”, line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask_compat.py”, line 35, in reraise raise value File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py”, line 1813, in full_dispatch_request rv = self.dispatch_request() File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py”, line 1799, in dispatch_request return self.view_functionsrule.endpoint File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\flask_cors\decorator.py”, line 128, in wrapped_function resp = make_response(f(*args, **kwargs)) File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core_sdk\endpoint.py”, line 86, in webhook response = executor.run(action_call) File “C:\Users\ambika662976\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_core_sdk\executor.py”, line 170, in run “”.format(action_name)) Exception: No registered Action found for name ‘action_default_fallback’.

Below are my files: Please suggest.

domain.yml slots: policyno: type: text

intents:

  • options
  • balance_inquiry
  • redirect_balance_inquiry
  • bill_pay
  • redirect_bill_pay
  • out_of_scope

entities:

  • policyno

templates: utter_options: - ’
A. New Quote (Select or Type “Quote”)
B. Renewal (Select or Type “Renewal”)
C. Endorsement (Select or Type “Endorsement”)
D. Balance Inquiry (Select or Type “Balance Inquiry”)
E. Make a Bill Payment (Select or Type “Bill Pay”)
F. New FNOL (Select or Type “New FNOL”)
G. Check Status of claim (Select or Type “Claim Status”)
H. Make a Loss Payment (Select or Type “Loss Payment”)’ utter_policy: - ‘For which Policy’ utter_default: - ‘Sorry, I didn’t understand that’

actions:

  • utter_options
  • utter_default
  • utter_policy
  • action_balance_inquiry
  • action_bill_pay
  • action_default_fallback

data.json { “rasa_nlu_data”: { “common_examples”: [ { “text”: “Options”, “intent”: “options”, “entities”: [] }, { “text”: “options”, “intent”: “options”, “entities”: [] }, { “text”: “OPTIONS”, “intent”: “options”, “entities”: [] }, { “text”: “POL123456”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 9, “value”: “POL123456”, “entity”: “policyno” } ] }, { “text”: “POL123”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 6, “value”: “POL123”, “entity”: “policyno” } ] }, { “text”: “POL1”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 4, “value”: “POL1”, “entity”: “policyno” } ] }, { “text”: “POL”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 3, “value”: “POL”, “entity”: “policyno” } ] }, { “text”: “POL12”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 5, “value”: “POL12”, “entity”: “policyno” } ] }, { “text”: “POL1234”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 7, “value”: “POL1234”, “entity”: “policyno” } ] }, { “text”: “POL12345”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 8, “value”: “POL12345”, “entity”: “policyno” } ] }, { “text”: “AC123”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 5, “value”: “AC123”, “entity”: “policyno” } ] }, { “text”: “ACL12345634”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 11, “value”: “ACL12345634”, “entity”: “policyno” } ] }, { “text”: “acPOL123456”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 11, “value”: “acPOL123456”, “entity”: “policyno” } ] }, { “text”: “12345678”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 8, “value”: “12345678”, “entity”: “policyno” } ] }, { “text”: “POLICY678”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 9, “value”: “POLICY678”, “entity”: “policyno” } ] }, { “text”: “01-PR-000011935-0”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 17, “value”: “01-PR-000011935-0”, “entity”: “policyno” } ] }, { “text”: “01-BP-000010668-1”, “intent”: “redirect_balance_inquiry”, “entities”: [ { “start”: 0, “end”: 17, “value”: “01-BP-000010668-1”, “entity”: “policyno” } ] }, { “text”: “Balance Inquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “Balance inquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “balance inquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “balance Inquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “balanceinquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “Balanceinquiry”, “intent”: “balance_inquiry”, “entities”: [] }, { “text”: “Bill Pay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “Bill pay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “bill Pay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “bill pay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “BILL PAY”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “billpay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “BillPay”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “BILLPAY”, “intent”: “bill_pay”, “entities”: [] }, { “text”: “POL64357384956G”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 15, “value”: “POL64357384956G”, “entity”: “policyno” } ] }, { “text”: “POL684902182”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 12, “value”: “POL684902182”, “entity”: “policyno” } ] }, { “text”: “AC5634890POL”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 12, “value”: “AC5634890POL”, “entity”: “policyno” } ] }, { “text”: “POLFG567889”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 11, “value”: “POLFG567889”, “entity”: “policyno” } ] }, { “text”: “01-CP-000014917-0”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 17, “value”: “01-CP-000014917-0”, “entity”: “policyno” } ] }, { “text”: “01-DF-000014913-0”, “intent”: “redirect_bill_pay”, “entities”: [ { “start”: 0, “end”: 17, “value”: “01-DF-000014913-0”, “entity”: “policyno” } ] }, { “text”: “basbas hgodfl”, “intent”: “out_of_scope”, “entities”: [] }, { “text”: “121278s8s8d87sd78uysdy”, “intent”: “out_of_scope”, “entities”: [] }, { “text”: “shdshdjhsjd skdksjdkjjksd”, “intent”: “out_of_scope”, “entities”: [] }, { “text”: “ASKAHSKJ87 JFDFJ7898SF9D”, “intent”: “out_of_scope”, “entities”: [] }, { “text”: “ASASJKGDFHDVF JSDSD HSDKA9728923H”, “intent”: “out_of_scope”, “entities”: [] }, { “text”: “562357238JKDSHDJGSDG;AK;AISPIASJKASH0-==98723723”, “intent”: “out_of_scope”, “entities”: [] } ] } }

stories.md

story_001

  • options
    • utter_options

story_002

  • balance_inquiry
    • utter_policy
  • redirect_balance_inquiry
    • action_balance_inquiry

story_003

  • bill_pay
    • utter_policy
  • redirect_bill_pay
    • action_bill_pay

story_004

  • out_of_scope
    • action_default_fallback

story_005

  • options
    • utter_options
  • out_of_scope
    • action_default_fallback

Generated Story -4790592658419116507

  • options
    • utter_options
  • balance_inquiry
    • utter_policy
  • redirect_balance_inquiry{“policyno”: “RAGPOL1”}
    • slot{“policyno”: “RAGPOL1”}
    • action_balance_inquiry
    • action_restart

Generated Story 0

Generated Story -7797485976636242542

  • options
    • utter_options
  • balance_inquiry
    • utter_policy
  • redirect_balance_inquiry{“policyno”: “TESTPOLICY01”}
    • slot{“policyno”: “TESTPOLICY01”}
    • action_balance_inquiry
    • action_restart

Generated Story 0

Generated Story -4053930244474633241

  • balance_inquiry
    • utter_policy
  • redirect_balance_inquiry{“policyno”: “ragpol1”}
    • slot{“policyno”: “ragpol1”}
    • action_balance_inquiry
    • action_restart

Generated Story 0

Generated Story -7797485976636242542

  • options
    • utter_options
  • bill_pay
    • utter_policy
  • redirect_bill_pay{“policyno”: “TESTPOLICY01”}
    • slot{“policyno”: “TESTPOLICY01”}
    • action_bill_pay
    • action_restart

Generated Story -4053930244474633255

  • bill_pay
    • utter_policy
  • redirect_bill_pay{“policyno”: “ragpol1”}
    • slot{“policyno”: “ragpol1”}
    • action_bill_pay
    • action_restart

Did you define a custom action_default_fallback in your action file? Otherwise it shouldn’t be in your domain file.

actions:

* utter_options
* utter_default
* utter_policy
* action_balance_inquiry
* action_bill_pay
* **action_default_fallback**

Also you should have a policy file which contains:

 - name: TwoStageFallbackPolicy
   nlu_threshold: 0.5

And last, you don’t have to call the action in your stories, if the nlu confidence is below the threshold, it will automatically call the default fallback action

No, I don’t have a custom action_default_fallback. I have added the policy details in python file. Like below:

def train_dialogue(domain_file = ‘majesco_domain.yml’, model_path = ‘./models/dialogue’, training_data_file = ‘./data/stories.md’):

fallback = FallbackPolicy(fallback_action_name="action_default_fallback",core_threshold=0.3,nlu_threshold=0.3)
agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy(max_history=3, epochs=200, batch_size=50),fallback])
data = agent.load_data(training_data_file)
agent.train(data)			
agent.persist(model_path)
return agent

I will check after removing from stories and domain files.

Just to be clear about what I said:

“And last, you don’t have to call the action in your stories, if the nlu confidence is below the threshold, it will automatically call the default fallback action”

It is not necessary to call the action in the story, however if you want to define a certain intent that calls the fallback action, you can call it in the story file.

So if you want to have a intent out of scope, for example when you have a restaurant bot which doesn’t know anything about pizza (it is a silly example, I know)

## intent: out_of_scope
- I want pizza
- I need pizza
- Can I have pizza

utter_default: 'Sorry, I don't know anything about that'

You could have a story that looks like

out_of_scope
* action_default_fallback

Yeah. I had included it in stories to do this.

Thanks rbossie rianne. It worked as per my requirement without including in stories. Thank you ver much !!!