Hi @Juste.
Thank you for your post.
We went through your post as well
We have a FormAction that has a postal code as an only slot in the domain file:
forms:
- store_search_form
we have the slots under corresponding utterances for our single slot also in the domain file (the 2nd stores slot is where our submit action puts the response back for UI stories):
slots:
postal_code:
type: unfeaturized
stores:
type: unfeaturized
And we have the convention-based utterance that FormAction needs to prompt the user for the only value it needs as per the required_slots method:
templates:
utter_ask_postal_code:
- text: "Please enter the Postal Code you wish to use to search for a Bell Store"
utter_postal_code_slot_value:
- text: "I am going to run a Google API search for The Source near:{postal_code}"
The second utterance we use to echo back to make sure form slot was populated correctly.
Our form action in actions.py that dictate the required slots.
class FormActionSearchStores(FormAction):
def name(self):
return 'store_search_form'
@staticmethod
def required_slots(tracker):
# type: () -> List[Text]
return ["postal_code"]
And our story:
* locate_store
- store_search_form
- form{"name": "store_search_form"}
- utter_postal_code_slot_value
- action_suggest
- form{"name": null}
- utter_goodbye
- action_restart
Note: I tried this configuration with same effect:
* locate_store
- store_search_form
- form{"name": "store_search_form"}
- form{"name": null}
- utter_postal_code_slot_value
- action_suggest
- utter_goodbye
- action_restart
action_suggest simply sets the “stores” slot with the results.
And here is the problem: while the slots gets filled and my action cod runs and my API logic executes (in the action server log), it seems my conversation is falling back to the default policy due to stating it does not recognize the intent. It seems the 2 policies are fighting or we are doing something wrong.
Hers is the debug rasa core log. I’ve added notes where I provide inputs and then what happens after i hit enter:
Enter to bot: store locator
Bot log in debug mode
Recreating tracker for id 'UF97SURFC'
Received user message 'store locator' with intent '{'name': 'locate_store', 'confidence': 0.778114378452301}' and entities '[]'
Logged UserUtterance - tracker now has 139 events
Current slot values:
requested_slot: None
name: None
stores: None
b1_number: None
postal_code: None
Current tracker state [None, None, None, {}, {'prev_action_listen': 1.0, 'intent_locate_store': 1.0}]
There is a memorised next action '69'
There is no active form
Predicted next action using policy_2_MemoizationPolicy
Predicted next action 'store_search_form' with prob 1.00.
Calling action endpoint to run action 'store_search_form'.
Action 'store_search_form' ended with events '['Form(store_search_form)', 'SlotSet(key: requested_slot, value: postal_code)']'
Bot utterance 'BotUttered(text: Please enter the Postal Code you wish to use to search for a Bell Store, data: {
"attachment": null,
"elements": null,
"buttons": null
})'
Current tracker state [None, None, None, {}, {'prev_action_listen': 1.0, 'intent_locate_store': 1.0}]
There is a memorised next action '69'
There is an active form 'store_search_form'
Predicted next action using policy_3_FormPolicy
Predicted next action 'action_listen' with prob 1.00.
Action 'action_listen' ended with events '[]'
Enter to bot: M2N1A1
Bog log in debug mode
Recreating tracker for id 'UF97SURFC'
Received user message 'M2N1A1' with intent '{'name': None, 'confidence': 0.0}' and entities '[{'entity': 'postal_code', 'extractor': 'ner_crf', 'end': 6, 'start': 0, 'value': 'M2N1A1', 'confidence': 0.968162055366042}]'
Logged UserUtterance - tracker now has 146 events
Current slot values:
requested_slot: postal_code
name: None
stores: None
b1_number: None
postal_code: M2N1A1
NLU confidence 0.0 is lower than NLU threshold 0.3. Predicting fallback action: action_default_fallback
Current tracker state [None, None, None, {}, {'prev_action_listen': 1.0, 'intent_locate_store': 1.0}]
There is a memorised next action '69'
There is an active form 'store_search_form'
Predicted next action using policy_3_FormPolicy
Predicted next action 'store_search_form' with prob 1.00.
Calling action endpoint to run action 'store_search_form'.
Action 'store_search_form' ended with events '['SlotSet(key: postal_code, value: M2N1A1)', 'SlotSet(key: stores, value: work time: Monday: 10:00 AM – 6:00 PM', 'Form(None)', 'SlotSet(key: requested_slot, value: None)']'
Bot utterance 'BotUttered(text: Form Action Submit complete, postal code is M2N1A1., data: {
"attachment": null,
"elements": null,
"buttons": null
})'
NLU confidence 0.0 is lower than NLU threshold 0.3. Predicting fallback action: action_default_fallback
Current tracker state [None, None, {}, {'prev_action_listen': 1.0, 'intent_locate_store': 1.0}, {'prev_store_search_form': 1.0, 'intent_locate_store': 1.0}]
There is a memorised next action '68'
There is no active form
Predicted next action using policy_1_FallbackPolicy
Predicted next action 'action_default_fallback' with prob 1.00.
Action 'action_default_fallback' ended with events '['UserUtteranceReverted()']'
Bot utterance 'BotUttered(text: I am sorry, I didn't understand that. Please try again., data: {
"attachment": null,
"elements": null,
"buttons": null
})'
Current tracker state [None, None, None, {}, {'prev_action_listen': 1.0, 'intent_locate_store': 1.0}]
There is a memorised next action '69'
There is an active form 'store_search_form'
Predicted next action using policy_3_FormPolicy
Predicted next action 'action_listen' with prob 1.00.
Action 'action_listen' ended with events '[]'
Note this part in the above:
Logged UserUtterance - tracker now has 146 events Current slot values: requested_slot: postal_code name: None stores: None b1_number: None postal_code: M2N1A1 NLU confidence 0.0 is lower than NLU threshold 0.3. Predicting fallback action: action_default_fallback
So while the form action executed I think successfully - in the UI - instead of the output from the Action (store hours above). It falls back to the default utterance of "I do not understand"
utter_default:
- text: "I am sorry, I didn't understand that. Please try again."
Can you help? How can we train/signal the bot that if the FormAction processed ok, that all is good? Are we missing something?
Or is this have nothing to do with Forms, but rather we have to keep working on the NLU training set? (keep in mind we have a good set of postal code - in phrases, out of phrases, lower/upper cases) - maybe 50 of each? Remember my post about the NLU training API crashing
Your help is much appreciated
Thanks
Serge