LoyVanBeek / wit_ros

Wrapper for the wit.ai natural language API
MIT License
10 stars 4 forks source link

ERROR: service [/wit/interpret] responded with an error: error processing request: 'outcomes' #9

Open rcpilotp51 opened 6 years ago

rcpilotp51 commented 6 years ago

Hello, did wit.ai change the json that comes back? I installed the package and i could get it to work with your api_key, but when i change it to mine with my own intent I get the following error:

ERROR: service [/wit/interpret] responded with an error: error processing request: 'outcomes'

I'm not sure how to fix this. any suggestions?

this is a sample outcomes in the log tab:

[ { "entities": { "intent": [ { "confidence": 0.96992436209788 "value": { "value": "teleop" } "entity": "intent" } ] } "confidence": null "_text": "turn right" "intent": "default_intent" "intent_id": "default_intent_id" } ]

LoyVanBeek commented 6 years ago

Hmm, that is interesting. I requested my API key ages ago.

Also, according to the docs (Dated to march 3, 2017)), their API is versioned by date. Given the date of that page, I assume the format hasn't changed since March.

But looking at the docs, 'outcomes' is only used in https://wit.ai/docs/http/20170307#get--messages-:msg-id-(deprecated)-link.

For the message-API, Could you please try to change https://github.com/LoyVanBeek/wit_ros/blob/master/src/wit_ros/wit_node.py#L28 into

entities = response["entities"]
rcpilotp51 commented 6 years ago

Thanks for your response. I tried that and got:

[ERROR] [1513730968.147115]: Error processing request: 'outcomes' ['Traceback (most recent call last):\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 625, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/kbrown/Development/ros/ws/src/wit_ros/src/wit_ros/wit_node.py", line 62, in interpret\n return self.parse_response(wit_response, InterpretResponse)\n', ' File "/home/kbrown/Development/ros/ws/src/wit_ros/src/wit_ros/wit_node.py", line 43, in parse_response\n outcome = Outcome( confidence = float(response["outcomes"][0]["confidence"]),\n', "KeyError: 'outcomes'\n"]

rcpilotp51 commented 6 years ago

i changed the following and it seems to be working: entities = response["entities"] outcome = Outcome( confidence = float(entities["intent"][0]["confidence"]), entities = ros_entities, intent = str(entities["intent"][0]["value"]))

LoyVanBeek commented 6 years ago

Could you make a PR with that? I have some tests on travis which I'd like to run against that patch.

rcpilotp51 commented 6 years ago

update on this: doesnt seem to be working with multiple entities and fails to pull the intent -

[ERROR] [1521648149.714662]: Error processing request: 'intent' ['Traceback (most recent call last):\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 625, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/kbrown/Development/ros/ws/src/wit_ros/src/wit_ros/wit_node.py", line 70, in interpret\n return self.parse_response(wit_response, InterpretResponse)\n', ' File "/home/kbrown/Development/ros/ws/src/wit_ros/src/wit_ros/wit_node.py", line 50, in parse_response\n outcome = Outcome( confidence = float(entities["intent"]["confidence"]),\n', "KeyError: 'intent'\n"]

i modified my app to have one intent teleop_intent with the value of "navigation" - with entities "direction" and "heading"

direction = forward, back, left right ... north, south, etc heading = 120, 50, ...

example: "turn left to a heading of 120" or "face north" or "turn left and face north"

any help would be appreciated

LoyVanBeek commented 6 years ago

Is there a way I can test with your Wit apps somehow? Things seem to work fine with the few Wit apps that I have. My box runs v 4.3.0 of wit:

$ pip2 freeze | grep -i wit
wit==4.3.0
rcpilotp51 commented 6 years ago

pip2 freeze | grep -i wit wit==4.3.0

I have the same version. Let me know your username at wit.ai im assuming "LoyVanBeek" (nope)

rcpilotp51 commented 6 years ago

@LoyVanBeek what is your wit.ai username I'll share my wit account with you. Thanks

LoyVanBeek commented 6 years ago

Hey, I though I already responded, sorry. My username on wit.ai is 'yol'

rcpilotp51 commented 6 years ago

Thank you - sent

On Mon, Mar 26, 2018 at 2:42 PM, Loy notifications@github.com wrote:

Hey, I though I already responded, sorry. My username on wit.ai is 'yol'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LoyVanBeek/wit_ros/issues/9#issuecomment-376270054, or mute the thread https://github.com/notifications/unsubscribe-auth/APGf8tty9CtXmW2HHl4mqLJ0XzG1s_l-ks5tiTangaJpZM4RGSAM .

rcpilotp51 commented 6 years ago

@LoyVanBeek have you had a chance to look into the issue? curious what you found.

LoyVanBeek commented 6 years ago

I finally found some time to look into this, I've barely been at home these last 2 weeks.

Apparently my own intents are drastically out of date and deprecated even, so I added a warning to warn for deprecation.

Your stuff seems to work now on branch fix/#9. Please check if it works correctly now.

rcpilotp51 commented 6 years ago

i may have to remove and re-clone git is not picking up the changes.

On Mon, Apr 9, 2018 at 4:17 PM, Loy notifications@github.com wrote:

I finally found some time to look into this, I've barely been at home these last 2 weeks.

Apparently my own intents are drastically out of date and deprecated even, so I added a warning to warn for deprecation.

Your stuff seems to work now on branch fix/#9 https://github.com/LoyVanBeek/wit_ros/pull/10. Please check if it works correctly now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LoyVanBeek/wit_ros/issues/9#issuecomment-379880458, or mute the thread https://github.com/notifications/unsubscribe-auth/APGf8hZh3k7OcRMOiSSMqbfpSES-oSwkks5tm8HagaJpZM4RGSAM .

LoyVanBeek commented 6 years ago

It's on the fix/#9 branch. I can see those changes on github, so 100% sure I pushed those changes.

rcpilotp51 commented 6 years ago

@LoyVanBeek great work i can confirm that fix/#9 is working - my intents are just CRAP ;)

THANK YOU very much for spending time on this.

rcpilotp51 commented 6 years ago

side note: are you using this with voice recognition? if so what does that look like?

LoyVanBeek commented 6 years ago

I don't use it at all lately, not with voice either.

rcpilotp51 commented 6 years ago

Thanks again. This is going to be the basis of the "intelligent" side of my robot.