wit-ai / pywit

Python library for Wit.ai
Other
1.45k stars 359 forks source link

How should I train the bot via https request #154

Closed padilhalucas closed 10 months ago

padilhalucas commented 3 years ago

I want to train the bot via https request. I am using python to do so. But I encounter problems (400 ERROR), which means that I am doing something wrong here. I want to train a simple sentence, only with an intention and without entities.

My code: endpoint = "https://api.wit.ai/utterances?v=20210508&q/" TOKEN = "###" headers = { 'Authorization': f"Bearer {TOKEN}", 'Content-Type': 'application/json' } data = '[{ "text": "São Paulo", "intent": "conversa_cidade", "entities": [ { "entity":"", "start":"", "end":"", "body":"", "entities":[]}], "traits":[]]' response = requests.post(endpoint,headers,data)

Thank you!

ChrisyShine commented 3 years ago

@padilhalucas Can you share the AppID? And how about sending the request with curl (Refer to the doc: https://wit.ai/docs/http/20200513/#post__utterances_link)? Did curl request work? If curl request works, the problem should be in your python code.

chessai commented 3 years ago

@padilhalucas Can you try using the new train method? It's in the master branch.