Rasa: Testing error in rasa_nlu

Created on 15 Jan 2018  路  14Comments  路  Source: RasaHQ/rasa

I got the latest version of rasa_nlu cloned from github.
I trained my model following the tutorial from here.
After trainning with a full demo-rasa.json file upon putting the following request:
"curl -X POST localhost:5000/parse -d '{"q":"I am looking for Chinese food"}' | python -m json.tool" from another cmd I simply get this error.
C:\Users\AppData\Local\Programs\Python\Python36\Lib\site-packages\rasa_nlu>curl -X POST localhost:5000/parse -d '{"q":"I am looking for Chinese food"}' | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5634 100 5599 100 35 4479 28 0:00:01 0:00:01 --:--:-- 4479 Expecting value: line 1 column 1 (char 0)

and on the server window:
`INFO:__main__:Started http server on port 5000
2018-01-15 20:01:24+0530 [-] Log opened.
2018-01-15 20:01:24+0530 [-] Site starting on 5000
2018-01-15 20:01:24+0530 [-] Starting factory
2018-01-15 20:02:59+0530 [_GenericHTTPChannelProtocol,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\klein\app.py", line 48, in _call
result = f(instance, args, *kwargs)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\server.py", line 98, in decorated
return f(args, *kwargs)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\server.py", line 81, in decorated
return f(args, *kwargs)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1532, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- ---
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1386, in _inlineCallbacks
result = g.send(result)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\server.py", line 142, in parse_get
request.content.read().decode('utf-8', 'strict'))
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson__init__.py", line 516, in loads
return _default_decoder.decode(s)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2018-01-15 20:02:59+0530 [-] "127.0.0.1" - - [15/Jan/2018:14:32:58 +0000] "POST /parse HTTP/1.1" 500 5599 "-" "curl/7.43.0"
`
I have googled and searched evrything.
Why am I getting this error...what am i doing wrong.I installed from github.
have got a scipy sklearn-crfsuite for Entity extraction.

windows type

Most helpful comment

Maybe the same problem as #669?

curl -X POST "http://localhost:5000/parse" -d "{\"q\":\"I am looking for Chinese food\"}" | python -m json.tool

All 14 comments

Why is no one replying to this?

maybe this is Windows specific

I'm using the bash on Windows and it is working well with rasa.
https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/

@SATACHAKRA thank you for submitting your issue. We are working hard to make rasa the best product we can. And while we care about all issues, our time is limited, so please have some patience. Thank you @bastiW for stepping in, we rely on the community to support each other!

Your problem seems to be encoding related, which might be caused by some windows default setting. If the bash solution didn't help, could you try adding the following header to your curl request?
-H "Content-Type: application/json; charset=utf-8"
So that it becomes
curl -X POST -H "Content-Type: application/json; charset=utf-8" localhost:5000/parse -d '{"q":"I am looking for Chinese food"}' | python -m json.tool

Let me try this.

@twerkmeister
It is still showing the same error.
`C:\Users\AppData\Local\Programs\Python\Python36\rasa_nlu>curl -X POST -H "Content-Type: application/json; charset=utf-8" localhost:5000/parse -d '{"q":"I am looking for flights to Rome."}' | python -m json.tool

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5629 100 5590 100 39 23888 166 --:--:-- --:--:-- --:--:-- 23888
Expecting value: line 1 column 1 (char 0)`

I have prepared my own training set and want to create a flight booking mechanism.Training goes ok.
But still this error is shown.

@bastiW-I dont want to shift to bash shell.
I have to make this work in widows environment as per client specifications.

@twerkmeister
This is the full error Traceback:

2018-01-17 12:19:13+0530 [-] "127.0.0.1" - - [17/Jan/2018:06:49:12 +0000] "POST /parse HTTP/1.1" 500 5590 "-" "curl/7.43.0" 2018-01-17 12:19:52+0530 [_GenericHTTPChannelProtocol,1,127.0.0.1] Unhandled Error Traceback (most recent call last): File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\klein\app.py", line 48, in _call result = f(instance, *args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 99, in decorated return f(*args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 82, in decorated return f(*args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1532, in unwindGenerator return _inlineCallbacks(None, gen, Deferred()) --- <exception caught here> --- File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1386, in _inlineCallbacks result = g.send(result) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 143, in parse_get request.content.read().decode('utf-8', 'strict')) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\__init__.py", line 516, in loads return _default_decoder.decode(s) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Try this
curl -i -X POST -H "Content-Type:application/json" -d "{\"q\": \"I am looking for Chinese food\", \"model\" : \"your_model_name\" }" http://localhost:5000/parse

I also had the same issue today . I ran Rasa_nlu for the 1st time today in windows.
This solved my issue @SATACHAKRA

@somnathkhamaru
This is the result:
curl -i -X POST -H "Content-Type:application/json" -d "{"q": "I am looking for Chinese food", "model" : "model_20180117-185927" }" http://localhost:5000/parse curl: (6) Could not resolve host: am curl: (6) Could not resolve host: looking curl: (6) Could not resolve host: for curl: (6) Could not resolve host: Chinese curl: (3) [globbing] unmatched close brace/bracket in column 37 HTTP/1.1 500 Internal Server Error Server: TwistedWeb/17.9.0 Date: Wed, 17 Jan 2018 13:31:31 GMT Content-Type: text/html Content-Length: 5658

Traceback:
2018-01-17 19:01:31+0530 [_GenericHTTPChannelProtocol,0,127.0.0.1] Unhandled Error Traceback (most recent call last): File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\klein\app.py", line 48, in _call result = f(instance, *args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 99, in decorated return f(*args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 82, in decorated return f(*args, **kwargs) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1532, in unwindGenerator return _inlineCallbacks(None, gen, Deferred()) --- <exception caught here> --- File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\twisted\internet\defer.py", line 1386, in _inlineCallbacks result = g.send(result) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\rasa_nlu\rasa_nlu\server.py", line 143, in parse_get request.content.read().decode('utf-8', 'strict')) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\__init__.py", line 516, in loads return _default_decoder.decode(s) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "C:\Users\anish\AppData\Local\Programs\Python\Python36\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

No success.
Can someone point me in the right direction?

Maybe the same problem as #669?

curl -X POST "http://localhost:5000/parse" -d "{\"q\":\"I am looking for Chinese food\"}" | python -m json.tool

@SATACHAKRA please use localhost ip like "127.0.0.1" in place of the word "localhost". I got same error , it was not able to recognise localhost.

so the command will be

curl -i -X POST -H "Content-Type:application/json" -d "{"q": "I am looking for Chinese food", "model" : "your_model_name" }" http://127.0.0.1:5000/parse

@wrathagom
WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Cool man..thanks.
Currently I am trying to get the intents with Python as shown in the tutorial.Results are coming.
But could you kindly suggest me any other place from where I can have more idea about using the rasa_nlu with python...apart from the documentation? My project is based on a flight booking chatbot.

@somnathkhamaru
sorry brother but your code didn't work...maybe some issues with the environment.
Still thanks for the help.

@SATACHAKRA please join the gitter channel and ask for tutorials/etc there are several of us that have written different forms of tutorials and guides.

Was this page helpful?
0 / 5 - 0 ratings