swapagarwal / JARVIS-on-Messenger

:speech_balloon: A community-driven python bot that aims to be as simple as possible to serve humans with their everyday tasks
https://m.me/J.A.R.V.I.S.on.Messenger
MIT License
1.34k stars 990 forks source link

Support for newer wit api #256

Open ahmedsadman opened 6 years ago

ahmedsadman commented 6 years ago

Newer version of wit ai sends a different response structure. Now there is no separate intent key, instead intent is now integrated inside entities. Pull request #255 was created to handle newer api response structure

Sent from my Xiaomi MI 5 using FastHub

swapagarwal commented 6 years ago

Hi @ahmedsadman, I looked into the Wit.ai docs. The version parameter is a date that essentially represents the "version" of the API we expect from Wit. It is designed to give developers the freedom to adapt to API changes on their own schedule. Basically, the date in YYYYMMDD format tells "I'm prepared for API changes up to this date." Can you try calling Wit using v=20160420 ?

ahmedsadman commented 6 years ago

@swapagarwal I had already tried those. But as you asked I did it again and got the following response:

{'WARNING': 'DEPRECATED',
 '_text': 'soccer live',
 'msg_id': '00QaXib7V4nvQdbvi',
 'outcomes': [{'_text': 'soccer live',
               'confidence': 'null',
               'entities': {'intent': [{'confidence': 1,
                                        'value': 'soccer'}],
                            'mode': [{'confidence': 0.93001728528262,
                                      'type': 'value',
                                      'value': 'live'}]},
               'intent': 'default_intent'}]}

As you can see, "intent" is set as "default intent", which I don't know where it came from, nor there is any option in the WIT to change the "default_intent" to some other value. And the intent I ACTUALLY set is integrated in the entities, which is "soccer". So, the problem of mine still exists.