Hi
I created story using forms but when all the slots gets set and form(user_easypay1_form) get deactivated instead of going to next action(action_due_amount_check) it goes to fallback action as nlu threshold is less than nlu threshold i mentioned in config file but here i defined slots as free text (ie it should not depend on nlu data) in actions.py but it still checks nlu when ever i enter values for slots.Can you please let me know how to solve this issue
Below is a story and actions.py
make_a_payment_easy_pay
- user_payment_message
- action_rasa_properties
- slot{“owcs_url”:"/u01/app/anaconda3"}
- slot{“common_url”:"/u01/app/anaconda3"}
- action_check_user_login_or_not
- slot{“login_check_user” : 0}
- action_get_payment_again_slot_validate
- slot{“get_payment_again”:0}
- utter_message_login_credentials
- utter_yes_no_buttons
- deny
- user_easypay1_form
- form{“name”: “user_easypay1_form”}
- slot{“err_reason”:“noerror”}
- slot{“billingentityname”:“VAEP TESTER”}
- slot{“dueamount”:“123”}
- slot{“groupsyskey”:“15565”}
- slot{“billingentitysyskey”:“37366”}
- slot{“brandCode”:“VIRGINIA”}
- slot{“systemcode”:“STAR”}
- slot{“businessunitcode”:“SMGRP”}
- slot{“lockboxnumber”:“11792”}
- form{“name”:“null”}
- action_due_amount_check
- slot{“due_amount_check”:“pass”}
- action_due_amount_check_validated
- slot{“due_amount_flag”: 0}
- utter_payment_message
- utter_yes_no_buttons
- affirm
- utter_make_a_payment_select_options
- utter_make_a_payment_select_buttons
- paymentselectoption_complete
- utter_type_payment
- utter_type_payment_buttons
- paymenttype{“accounttype”:“Checking”}
- user_easypay2_form
- form{“name”: “user_easypay2_form”}
- form{“name”:“null”}
- utter_receive_payment_mail
- utter_yes_no_buttons
- affirm
- utter_email_message
- user_email{“Email_address":"nara@yah.com”}
- utter_review_payment_details
- action_payment_details_review
- utter_yes_no_buttons
- affirm
- action_bank_payment_easypay_success
- action_due_amount_check
- slot{“due_amount_check”:“pass”}
- action_due_amount_check_validated
- slot{“due_amount_flag”: 0}
- utter_ask_rating
- utter_rating_buttons
- user_rating{“rate”:“poor”}
- utter_thanks
- action_user_restart
actions.py: class UserLoginForm1(FormAction): “”“Example of a custom form action”""
def name(self):
"""Unique identifier of the form"""
return "user_easypay1_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
print("*************required slots form has to fill started****************")
return ["group_num","tax_id"]
def slot_mappings(self):
# type: () -> Dict[Text: Union[Dict, List[Dict]]]
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
print("*****slot mappings*******")
return {"group_num": [self.from_text()],
"tax_id": [self.from_text()]}
def submit(self,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> List[Dict]:
"""Define what the form has to do after all required slots are filled"""
print("******Submitted button activated**********")
print("Enter into validation Part of api")
# utter submit template
group_num= tracker.get_slot('group_num')
tax_id= tracker.get_slot('tax_id')
print("Valid")
API_ENDPOINT="some link"
params={"values"}
print("params",params)
print("API_ENDPOINT",API_ENDPOINT)
try:
response = json.loads(requests.post(url=API_ENDPOINT,json=params).text)
print("**************response for make a payment easy pay**************",response)
if(response["billingDetailsList"] is not None):
print("you have successfully loaded")
billingentityname=response["billingDetailsList"][0]["billingEntityName"]
dueAmount=response["billingDetailsList"][0]["invoiceDetails"][0]["amount"]
groupsyskey=response["billingDetailsList"][0]["groupSysKey"]
billingentitysyskey=response["billingDetailsList"][0]["billingEntitySysKey"]
brandCode=response["billingDetailsList"][0]["brandCode"]
systemcode=response["billingDetailsList"][0]["systemCode"]
businessunitcode=response["billingDetailsList"][0]["businessUnitCode"]
lockboxnumber=response["billingDetailsList"][0]["lockBoxNumber"]
print("!!!!!!!!!!Slots field set!!!!!!!!")
print("billingentityname : ",billingentityname)
print("dueAmount : ",dueAmount)
print("groupsyskey : ",groupsyskey)
print("billingEntitySysKey : ",billingentitysyskey)
print("brandCode : ",brandCode)
print("systemcode : ",systemcode)
print("businessunitcode : ",businessunitcode)
print("lockboxnumber : ",lockboxnumber)
dueAmount = str(dueAmount)
outMessage="The total outstanding amount for your "+group_num+"-"+billingentityname+" is "+"$"+dueAmount+"."
print("outMessage",outMessage)
dispatcher.utter_message(outMessage)
return[SlotSet("err_reason","no error"),SlotSet("billingentityname",billingentityname),SlotSet("dueamount",dueAmount),SlotSet("groupsyskey",groupsyskey),SlotSet("billingentitysyskey",billingentitysyskey),SlotSet("brandCode",brandCode),SlotSet("systemcode",systemcode),SlotSet("businessunitcode",businessunitcode),SlotSet("lockboxnumber",lockboxnumber)]
elif(response["billingDetailsList"] is None):
dispatcher.utter_template("utter_ask_other",tracker)
return[UserUtteranceReverted()]
except:
print("Error",sys.exc_info()[0])
outMessage="System is down please try again later"
dispatcher.utter_message(outMessage)
return[SlotSet("err_reason" ,"bill empty")]
config.yml:
Configuration for Rasa NLU.
Components
language: en pipeline: supervised_embeddings
Configuration for Rasa Core.
Policies
policies:
- name: MemoizationPolicy max_history: 37
- name: KerasPolicy max_history: 37
- name: MappingPolicy
- name: FormPolicy
- name: TwoStageFallbackPolicy nlu_threshold: 0.5 core_threshold: 0.5 fallback_nlu_action_name: “action_custom_fallback” fallback_core_action_name: “action_custom_fallback” deny_suggestion_intent_name: “out_of_scope”
Also please let me know how can i revert back and ask user again if user enter wrong values for slots in same form action