I have a Form that functions fine with the happy path. I have created a couple of unhappy paths with interactive learning but even when I follow those it won’t let the non-form path take over and I get the “Failed to extract slot…” message on my console.
However, if I type the same thing once again, it now correctly processes the non-happy path story flow. See attached image… the first time it is still stuck in form, but the second time it breaks out. How do I make it work the first time?
STORY EXAMPLE
## interactive_story_1
* currency_convert
- form_currency_conversion
- form{"name": "form_currency_conversion"}
- slot{"requested_slot": "from_currency"}
* form: currency_convert{"currency": "CNY"}
- form: form_currency_conversion
- slot{"from_currency": "CNY"}
- slot{"requested_slot": "to_currency"}
* form: currency_convert{"currency": "USD"}
- form: form_currency_conversion
- slot{"to_currency": "USD"}
- slot{"requested_slot": "curr_qty"}
* currency_rate
- action_get_currency_rate
- form_currency_conversion
- slot{"requested_slot": "curr_qty"}
* form: currency_convert{"curr_qty": "100"}
- form: form_currency_conversion
- slot{"curr_qty": "100"}
- slot{"converted_to_curr_qty": "14.09"}
- slot{"requested_slot": "currency_denomination"}
* form: currency_denomination
- form: form_currency_conversion
- slot{"currency_denomination": "tens and twenties"}
- slot{"from_currency": null}
- slot{"to_currency": null}
- slot{"curr_qty": null}
- slot{"currency_denomination": null}
- form{"name": null}
- slot{"requested_slot": null}
- utter_currrency_anything_else
* deny
- utter_goodbye
* goodbye
- utter_goodbye
In the above, I start form, enter from_currency, then to_currency and then I interrupt with question about currency_rate.
Relevant parts of CurrencyConversionForm(FormAction):
class CurrencyConversionForm(FormAction):
def name(self) -> Text:
return "form_currency_conversion"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return [ 'from_currency', 'to_currency', 'curr_qty', 'currency_denomination']
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"from_currency": [self.from_entity(entity="from_currency", intent="currency_convert"),
self.from_entity(entity="currency", intent="currency_convert")],
"to_currency": [self.from_entity(entity="to_currency", intent="currency_convert"),
self.from_entity(entity="currency", intent="currency_convert")],
"curr_qty": self.from_entity(entity="curr_qty", intent="currency_convert"),
"currency_denomination": self.from_text(intent="currency_denomination")
}
def validate_from_currency(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any],) -> Dict[Text, Any]:
tracker.slots['from_currency'] = value.upper()
return {'from_currency': value.upper()}
def validate_to_currency(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any],) -> Dict[Text, Any]:
tracker.slots['to_currency'] = value.upper()
return {'to_currency': value.upper()}
def validate_curr_qty(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any],) -> Dict[Text, Any]:
from_curr = tracker.slots.get('from_currency')
to_curr = tracker.slots.get('to_currency')
rate = ActionCurrencyRate().get_rate(from_curr, to_curr)
qty = 1 / rate * float(value)
qty_str = '{:.2f}'.format(qty)
return {'curr_qty': value, 'converted_to_curr_qty': qty_str}
LOG OUTPUT:
(The sad part about Failing to extract slot... is at end)
2019-09-17 17:53:47 INFO root - Starting Rasa server on http://localhost:5005
2019-09-17 17:53:47 INFO root - Enabling coroutine debugging. Loop id 140658434375704.
2019-09-17 17:53:47 DEBUG rasa.model - Extracted model to '/var/folders/wk/ynmgx56s43xcfzq2cc3_nmw40000gn/T/tmpg_1wdkd7'.
2019-09-17 17:53:47 DEBUG rasa.core.tracker_store - Connected to InMemoryTrackerStore.
2019-09-17 17:53:47 DEBUG rasa.model - Extracted model to '/var/folders/wk/ynmgx56s43xcfzq2cc3_nmw40000gn/T/tmpn816wc4v'.
2019-09-17 17:53:47 DEBUG pykwalify.compat - Using yaml library: /Users/michaelbrill/Documents/projects/fullyrun2/env/lib/python3.6/site-packages/ruamel/yaml/__init__.py
2019-09-17 17:54:00 DEBUG rasa.core.tracker_store - Creating a new tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'.
2019-09-17 17:54:00 DEBUG rasa.core.processor - Received user message 'i want to convert currency' with intent '{'name': 'currency_convert', 'confidence': 0.9689755439758301}' and entities '[]'
2019-09-17 17:54:00 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 2 events
2019-09-17 17:54:00 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:00 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:00 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:00 DEBUG rasa.core.policies.form_policy - There is no active form
2019-09-17 17:54:00 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_0_MemoizationPolicy
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'form_currency_conversion'.
2019-09-17 17:54:01 DEBUG rasa.core.processor - Action 'form_currency_conversion' ended with events '['BotUttered(text: What currency do you have?, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {"converted_to_curr_qty": null, "curr_qty": null, "currency_denomination": null, "from_currency": null, "requested_slot": null, "to_currency": null})', 'Form(form_currency_conversion)', 'SlotSet(key: requested_slot, value: from_currency)']'
2019-09-17 17:54:01 DEBUG rasa.core.processor - Current slot values:
converted_to_curr_qty: None
curr_qty: None
currency_denomination: None
from_currency: None
requested_slot: from_currency
to_currency: None
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:01 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:01 DEBUG rasa.core.policies.mapping_policy - There is no mapped action for the predicted intent, 'currency_convert'.
2019-09-17 17:54:01 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:01 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:01 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'
2019-09-17 17:54:01 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:07 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:07 DEBUG rasa.core.processor - Received user message 'CNY' with intent '{'name': 'currency_convert', 'confidence': 0.9669369459152222}' and entities '[{'start': 0, 'end': 3, 'value': 'CNY', 'entity': 'currency', 'confidence': 0.8591905717558912, 'extractor': 'CRFEntityExtractor'}]'
2019-09-17 17:54:07 DEBUG rasa.core.processor - Current slot values:
converted_to_curr_qty: None
curr_qty: None
currency_denomination: None
from_currency: None
requested_slot: from_currency
to_currency: None
2019-09-17 17:54:07 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 8 events
2019-09-17 17:54:07 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:07 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:07 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:07 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:07 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:07 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:07 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:07 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'form_currency_conversion'.
2019-09-17 17:54:07 DEBUG rasa.core.processor - Action 'form_currency_conversion' ended with events '['BotUttered(text: What would you like to convert your CNY into?, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {"converted_to_curr_qty": null, "curr_qty": null, "currency_denomination": null, "from_currency": "CNY", "requested_slot": "from_currency", "to_currency": null})', 'SlotSet(key: from_currency, value: CNY)', 'SlotSet(key: requested_slot, value: to_currency)']'
2019-09-17 17:54:07 DEBUG rasa.core.processor - Current slot values:
converted_to_curr_qty: None
curr_qty: None
currency_denomination: None
from_currency: CNY
requested_slot: to_currency
to_currency: None
2019-09-17 17:54:07 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:08 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:08 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:08 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:08 DEBUG rasa.core.policies.mapping_policy - There is no mapped action for the predicted intent, 'currency_convert'.
2019-09-17 17:54:08 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:08 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:08 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:08 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:08 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'
2019-09-17 17:54:08 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:10 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:10 DEBUG rasa.core.processor - Received user message 'USD' with intent '{'name': 'currency_convert', 'confidence': 0.9733215570449829}' and entities '[{'start': 0, 'end': 3, 'value': 'USD', 'entity': 'currency', 'confidence': 0.8844515839466134, 'extractor': 'CRFEntityExtractor'}]'
2019-09-17 17:54:10 DEBUG rasa.core.processor - Current slot values:
converted_to_curr_qty: None
curr_qty: None
currency_denomination: None
from_currency: CNY
requested_slot: to_currency
to_currency: None
2019-09-17 17:54:10 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 14 events
2019-09-17 17:54:10 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:10 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:10 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:10 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:10 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'form_currency_conversion'.
2019-09-17 17:54:11 DEBUG rasa.core.processor - Action 'form_currency_conversion' ended with events '['BotUttered(text: How much CNY do you have?, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {"converted_to_curr_qty": null, "curr_qty": null, "currency_denomination": null, "from_currency": "CNY", "requested_slot": "to_currency", "to_currency": "USD"})', 'SlotSet(key: to_currency, value: USD)', 'SlotSet(key: requested_slot, value: curr_qty)']'
2019-09-17 17:54:11 DEBUG rasa.core.processor - Current slot values:
converted_to_curr_qty: None
curr_qty: None
currency_denomination: None
from_currency: CNY
requested_slot: curr_qty
to_currency: USD
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:11 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:11 DEBUG rasa.core.policies.mapping_policy - There is no mapped action for the predicted intent, 'currency_convert'.
2019-09-17 17:54:11 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:11 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:11 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'
2019-09-17 17:54:11 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:16 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:16 DEBUG rasa.core.processor - Received user message 'what is the conversion rate' with intent '{'name': 'currency_rate', 'confidence': 0.9639586210250854}' and entities '[]'
2019-09-17 17:54:16 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 20 events
2019-09-17 17:54:16 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:16 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {'intent_currency_convert': 1.0, 'prev_action_listen': 1.0}]
2019-09-17 17:54:16 DEBUG rasa.core.policies.memoization - There is a memorised next action '22'
2019-09-17 17:54:16 DEBUG rasa.core.policies.form_policy - There is an active form 'form_currency_conversion'
2019-09-17 17:54:16 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_3_FormPolicy
2019-09-17 17:54:17 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:17 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
2019-09-17 17:54:17 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'form_currency_conversion'.
2019-09-17 17:54:17 ERROR rasa.core.actions.action - Failed to extract slot curr_qty with action form_currency_conversion
2019-09-17 17:54:17 DEBUG rasa.core.tracker_store - Recreating tracker for id '8cf093a3-aa2b-44d3-a88f-34287c5e641a'
Soooo, what am I doing wrong?