@adds_context and @removes_context erroring out

Hi All,

I am trying to implement the code from on the Mycroft wiki pertaining to conversational context. When running the code after including the the correct headers (what i believe to be correct) and the correct vocab files with 1 word utterances, i receive a message in the cli: “an error has occurred when processing the skill”.

I next commented out references to context in the first intent and the second intent. When I now enter “I want some tea”, the correct response “Of course, would you like milk with that?” response is prompted. I then try to enter in my next utterence “no” (which I have added adds_context too) and i receive the same message in the cli: “message that an error has occurred when processing the skill”.

Looks like it is erroring out in core.py

To sum I am trying to get @adds_context and @removes_context to work.

Anyone have any idea on how i can go about resolving this issue so i can use contexts as I am at a loss of what to do right now

Thank you!

Heres the error messages from my skills terminal:
15:03:36.652 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/84daaf99-09be-479c-88e8-8696b6b403e8/location HTTP/1.1" 200 4 15:04:06.007 - SKILLS - DEBUG - {"type": "recognizer_loop:utterance", "data": {"lang": "en-us", "utterances": ["i want some tea"]}, "context": null} 15:04:06.011 - SKILLS - DEBUG - {"type": "6580770612025384345:TeaIntent", "data": {"confidence": 0.5, "target": null, "intent_type": "6580770612025384345:TeaIntent", "__tags__": [{"end_token": 1, "start_token": 1, "from_context": false, "entities": [{"confidence": 1.0, "data": [["want", "TeaKeyword"]], "key": "want", "match": "want"}], "key": "want", "match": "want"}], "utterance": "i want some tea", "TeaKeyword": "want"}, "context": {"target": null}} 15:04:06.012 - mycroft.client.enclosure.display_manager:set_active:106 - DEBUG - Setting active skill to TeaSkill 15:04:06.015 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.start", "data": {"handler": "handle_tea_intent"}, "context": null} 15:04:06.020 - SKILLS - DEBUG - {"type": "speak", "data": {"expect_response": true, "utterance": "Of course, would you like milk with that?"}, "context": null} 15:04:06.061 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.complete", "data": {"handler": "handle_tea_intent"}, "context": null} 15:04:08.778 - SKILLS - DEBUG - {"type": "recognizer_loop:utterance", "data": {"lang": "en-us", "utterances": ["no"]}, "context": null} 15:04:08.780 - SKILLS - DEBUG - {"type": "skill.converse.request", "data": {"lang": "en-us", "skill_id": 6580770612025384345, "utterances": ["no"]}, "context": null} 15:04:08.782 - SKILLS - DEBUG - {"type": "skill.converse.response", "data": {"skill_id": 6580770612025384345, "result": false}, "context": null} 15:04:08.884 - SKILLS - DEBUG - {"type": "6580770612025384345:NoMilkIntent", "data": {"confidence": 1.0, "target": null, "intent_type": "6580770612025384345:NoMilkIntent", "__tags__": [{"end_token": 0, "start_token": 0, "from_context": false, "entities": [{"confidence": 1.0, "data": [["No", "NoKeyword"]], "key": "no", "match": "no"}], "key": "no", "match": "no"}], "utterance": "no", "NoKeyword": "No"}, "context": {"target": null}} 15:04:08.885 - mycroft.client.enclosure.display_manager:set_active:106 - DEBUG - Setting active skill to TeaSkill 15:04:08.887 - mycroft.skills.core:wrapper:364 - ERROR - An error occurred while processing a request in TeaSkill Traceback (most recent call last): File "/home/steve/mycroft-core/mycroft/skills/core.py", line 348, in wrapper raise TypeError TypeError 15:04:08.889 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.start", "data": {"handler": "handle_yes_milk_intent"}, "context": null} 15:04:08.891 - SKILLS - DEBUG - {"type": "speak", "data": {"expect_response": false, "utterance": "An error occurred while processing a request in TeaSkill"}, "context": null} 15:04:08.934 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.complete", "data": {"exception": "", "handler": "handle_yes_milk_intent"}, "context": null} 15:04:08.934 - SKILLS - DEBUG - {"type": "mycroft.skill.handler.complete", "data": {"handler": "handle_yes_milk_intent"}, "context": null} 15:04:36.656 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai 15:04:37.566 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/84daaf99-09be-479c-88e8-8696b6b403e8/setting HTTP/1.1" 200 2908 15:04:37.569 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai 15:04:38.077 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/84daa

Heres my code (It is uploaded with references to context in the first and second intent):

1 Like

Hi,

this is due to a bug recently introduced (trying to make the intent handlers easier to handle). There’s a Pull request fixing this pending in the mycroft-core repo and should be included in the next release.

In the meantime you can remove @adds_context() and @removes_context() and instead use self.set_context() and self.remove_context() at the end of the methods.

Sound good. Thank you for your quick reply