RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.82k stars 4.63k forks source link

Rasa Core HTTP Server not working - Expecting Value #1936

Closed atotalnoob closed 5 years ago

atotalnoob commented 6 years ago

Rasa Core version: 0.8.2, Rasa NLU 0.11.3

Python version: 3.6, Anaconda version 5.0.1

Operating system (windows, osx, ...): Windows Server 2012 R2 Standard

Issue:

Hi all!

I followed the instructions to the letter on the documentation, but I get an error when trying to run Rasa Core HTTP Server. I know the server is working, when I go to localhost:5005, I get a message that says "hello from Rasa Core: 0.8.2" I can also see that the requests are being recieved by the server.

Steps I took (all using example data):

Whenever I try to test it I get this error. I also tried from another computer and the same issue presented itself. I ran anaconda prompt as admin. The server logs are empty or I would post them.

Server output: `

(base) C:\Windows\system32>cd /

(base) C:\>cd rasa-bot

(base) C:\rasa-bot>cd rasa_core-master

(base) C:\rasa-bot\rasa_core-master>python -m rasa_core.server -d models/dialogu
e -u examples/moodbot/data/current -o out.log
:0: UserWarning: You do not have a working installation of the service_identity
module: 'No module named 'service_identity''.  Please install it from <https://p
ypi.python.org/pypi/service_identity> and make sure all of its dependencies are
satisfied.  Without the service_identity module, Twisted can perform only rudime
ntary TLS client hostname verification.  Many valid certificate/hostname mapping
s may be rejected.
Using TensorFlow backend.
2018-02-20 09:59:38.240854: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\te
nsorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions
that this TensorFlow binary was not compiled to use: AVX
2018-02-20 09:59:57-0500 [-] Log opened.
2018-02-20 09:59:57-0500 [-] Site starting on 5005
2018-02-20 09:59:57-0500 [-] Starting factory <twisted.web.server.Site object at
 0x000000A995470EF0>
2018-02-20 10:00:35-0500 [-] "IPADDRESS" - - [20/Feb/2018:15:00:35 +0000] "G
ET / HTTP/1.1" 200 27 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.3
6 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"
2018-02-20 10:01:35-0500 [-] Timing out client: IPv4Address(TCP, 'IPADDRESS'
, 52554)
2018-02-20 10:01:48-0500 [_GenericHTTPChannelProtocol,1,127.0.0.1] Unhandled Err
or
        Traceback (most recent call last):
          File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\web\server.py
", line 255, in render
            body = resrc.render(self)
          File "C:\ProgramData\Anaconda3\lib\site-packages\klein\resource.py", l
ine 210, in render
            d = defer.maybeDeferred(_execute)
          File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\defe
r.py", line 150, in maybeDeferred
            result = f(*args, **kw)
          File "C:\ProgramData\Anaconda3\lib\site-packages\klein\resource.py", l
ine 204, in _execute
            **kwargs)
        --- <exception caught here> ---
          File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\defe
r.py", line 150, in maybeDeferred
            result = f(*args, **kw)
          File "C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py", line 1
28, in execute_endpoint
            return endpoint_f(self._instance, *args, **kwargs)
          File "C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py", line 2
27, in _f
            return _call(instance, f, request, *a, **kw)
          File "C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py", line 5
0, in _call
            result = f(*args, **kwargs)
          File "C:\ProgramData\Anaconda3\lib\site-packages\rasa_nlu\server.py",
line 82, in decorated
            return f(*args, **kwargs)
          File "C:\ProgramData\Anaconda3\lib\site-packages\rasa_nlu\server.py",
line 99, in decorated
            return f(*args, **kwargs)
          File "C:\rasa-bot\rasa_core-master\rasa_core\server.py", line 199, in
parse
            request.content.read().decode('utf-8', 'strict'))
          File "C:\ProgramData\Anaconda3\lib\json\__init__.py", line 354, in loa
ds
            return _default_decoder.decode(s)
          File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 339, in deco
de
            obj, end = self.raw_decode(s, idx=_w(s, 0).end())
          File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 357, in raw_
decode
            raise JSONDecodeError("Expecting value", s, err.value) from None
        json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2018-02-20 10:01:48-0500 [-] "127.0.0.1" - - [20/Feb/2018:15:01:48 +0000] "POST
/conversations/default/parse HTTP/1.1" 500 9275 "-" "curl/7.55.1"
forrtl: error (200): program aborting due to control-C event
Image              PC                Routine            Line        Source

libifcoremd.dll    00007FFDF7CE94C4  Unknown               Unknown  Unknown
KERNELBASE.dll     00007FFE2500BBBF  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FFE275613D2  Unknown               Unknown  Unknown
ntdll.dll          00007FFE27AD54F4  Unknown               Unknown  Unknown

(base) C:\rasa-bot\rasa_core-master>`

Curl:


`
(base) C:\Users\username>curl -XPOST localhost:5005/conversations/default/parse -
d '{"query":"hello there"}'
<html><head><title>web.Server Traceback (most recent call last)</title></head><b
ody><b>web.Server Traceback (most recent call last):</b>

<div>
  <style type="text/css">
    div.error {
      color: red;
      font-family: Verdana, Arial, helvetica, sans-serif;
      font-weight: bold;
    }

    div {
      font-family: Verdana, Arial, helvetica, sans-serif;
    }

    div.stackTrace {
    }

    div.frame {
      padding: 1em;
      background: white;
      border-bottom: thin black dashed;
    }

    div.frame:first-child {
      padding: 1em;
      background: white;
      border-top: thin black dashed;
      border-bottom: thin black dashed;
    }

    div.location {
    }

    span.function {
      font-weight: bold;
      font-family: "Courier New", courier, monospace;
    }

    div.snippet {
      margin-bottom: 0.5em;
      margin-left: 1em;
      background: #FFFFDD;
    }

    div.snippetHighlightLine {
      color: red;
    }

    span.code {
      font-family: "Courier New", courier, monospace;
    }
  </style>

  <div class="error">
    <span>json.decoder.JSONDecodeError</span>: <span>Expecting value: line 1 col
umn 1 (char 0)</span>
  </div>
  <div class="stackTrace">
    <div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\defer.
py</span>:<span>150</span> in
        <span class="function">maybeDeferred</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">149</span>
          <code class="code"> &#160; &#160;try:</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">150</span>
          <code class="code"> &#160; &#160; &#160; &#160;result = f(*args, **kw)
</code>
        </div><div class="snippetLine">
          <span class="lineno">151</span>
          <code class="code"> &#160; &#160;except:</code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py</span>:<sp
an>128</span> in
        <span class="function">execute_endpoint</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">127</span>
          <code class="code"> &#160; &#160; &#160; &#160;endpoint_f = self._endp
oints[endpoint]</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">128</span>
          <code class="code"> &#160; &#160; &#160; &#160;return endpoint_f(self.
_instance, *args, **kwargs)</code>
        </div><div class="snippetLine">
          <span class="lineno">129</span>
          <code class="code"></code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py</span>:<sp
an>227</span> in
        <span class="function">_f</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">226</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;def _f(in
stance, request, *a, **kw):</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">227</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160; &#160; &
#160;return _call(instance, f, request, *a, **kw)</code>
        </div><div class="snippetLine">
          <span class="lineno">228</span>
          <code class="code"></code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\klein\app.py</span>:<sp
an>50</span> in
        <span class="function">_call</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">49</span>
          <code class="code"> &#160; &#160; &#160; &#160;args = (instance,) + ar
gs</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">50</span>
          <code class="code"> &#160; &#160;result = f(*args, **kwargs)</code>
        </div><div class="snippetLine">
          <span class="lineno">51</span>
          <code class="code"> &#160; &#160;if iscoroutine(result):</code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\rasa_nlu\server.py</spa
n>:<span>82</span> in
        <span class="function">decorated</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">81</span>
          <code class="code"> &#160; &#160; &#160; &#160;else:</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">82</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;return f(
*args, **kwargs)</code>
        </div><div class="snippetLine">
          <span class="lineno">83</span>
          <code class="code"></code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\site-packages\rasa_nlu\server.py</spa
n>:<span>99</span> in
        <span class="function">decorated</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">98</span>
          <code class="code"> &#160; &#160; &#160; &#160;if self.config['token']
 is None or token == self.config['token']:</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">99</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;return f(
*args, **kwargs)</code>
        </div><div class="snippetLine">
          <span class="lineno">100</span>
          <code class="code"> &#160; &#160; &#160; &#160;request.setResponseCode
(401)</code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\rasa-bot\rasa_core-master\rasa_core\server.py</span>:<span>199<
/span> in
        <span class="function">parse</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">198</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;request_p
arams = json.loads(</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">199</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160; &#160; &
#160; &#160; &#160;request.content.read().decode('utf-8', 'strict'))</code>
        </div><div class="snippetLine">
          <span class="lineno">200</span>
          <code class="code"></code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\json\__init__.py</span>:<span>354</sp
an> in
        <span class="function">loads</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">353</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;parse_con
stant is None and object_pairs_hook is None and not kw):</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">354</span>
          <code class="code"> &#160; &#160; &#160; &#160;return _default_decoder
.decode(s)</code>
        </div><div class="snippetLine">
          <span class="lineno">355</span>
          <code class="code"> &#160; &#160;if cls is None:</code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\json\decoder.py</span>:<span>339</spa
n> in
        <span class="function">decode</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">338</span>
          <code class="code"> &#160; &#160; &#160; &#160;"""</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">339</span>
          <code class="code"> &#160; &#160; &#160; &#160;obj, end = self.raw_dec
ode(s, idx=_w(s, 0).end())</code>
        </div><div class="snippetLine">
          <span class="lineno">340</span>
          <code class="code"> &#160; &#160; &#160; &#160;end = _w(s, end).end()<
/code>
        </div>
      </div>
    </div><div class="frame">
      <div class="location">
        <span>C:\ProgramData\Anaconda3\lib\json\decoder.py</span>:<span>357</spa
n> in
        <span class="function">raw_decode</span>
      </div>
      <div class="snippet">
        <div class="snippetLine">
          <span class="lineno">356</span>
          <code class="code"> &#160; &#160; &#160; &#160;except StopIteration as
 err:</code>
        </div><div class="snippetHighlightLine">
          <span class="lineno">357</span>
          <code class="code"> &#160; &#160; &#160; &#160; &#160; &#160;raise JSO
NDecodeError("Expecting value", s, err.value) from None</code>
        </div><div class="snippetLine">
          <span class="lineno">358</span>
          <code class="code"> &#160; &#160; &#160; &#160;return obj, end</code>
        </div>
      </div>
    </div>
  </div>
  <div class="error">
    <span>json.decoder.JSONDecodeError</span>: <span>Expecting value: line 1 col
umn 1 (char 0)</span>
  </div>
</div>

</body></html>

(base) C:\Users\Username>`

Content of domain file (if used & relevant):

atotalnoob commented 6 years ago

It seems to work just fine using GET instead of POST.

Is this an error in the documentation or what?

tmbo commented 6 years ago

@atotalnoob I've added some debug output to the /parse endpoint that gets called if the json deserialisation fails. Do you mind trying your example with the latest master version and sharing the console log? (please not only copy the exception but also the logger lines before that exception)

SibaprasadM commented 6 years ago

Hey Tom, I'm having similar issue. Have used the latest master version.

Rasa Core version: 0.8.2, Rasa NLU 0.11.3 Python version: 3.6.3 , Anaconda version 5.1.0, tensorflow : 1.4.0 ( I think this needs correction in requirements.txt for rasa core as there is no pip version available for tensorflow 1.4.1 ) Operating system : Windows 7

Issue:

/parse and /continue endpoints not working with curl -XPOST

/parse endpoint is somehow giving response with get: payload = {"query": "Hi" } response = requests.get('http://localhost:5005/conversations/default/parse',params=payload).json() print(response)

/continue endpoint is not working with either get or post As /continue end point is not working , unble to manage slot states.

Can we use requests.post( ) instead of curl ?

Curl Command Executed: curl -XPOST localhost:5005/conversations/default/parse -d '{"query":"hi"}'

HTTP Server Log: ================ (py36) D:\BOT\dbbot>python -m rasa_core.server -d models/dialogue -u models/nlu/default/current -o out.log 2018-03-03 23:49:38 WARNING py.warnings - C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\h5py__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.

from ._conv import register_converters as _register_converters

Using TensorFlow backend. 2018-03-03 23:50:18+0530 [-] Log opened. 2018-03-03 23:50:18+0530 [-] Site starting on 5005 2018-03-03 23:50:18+0530 [-] Starting factory <twisted.web.server.Site object at 0x00000000384086D8> 2018-03-03 23:50:37+0530 [-] 2018-03-03 23:50:37 ERROR main - Failed to decode json during parse request. Error: Expecting value: line 1 column 1 (char 0). Request content: 'b"'{query:hi}'"' 2018-03-03 23:50:37+0530 [_GenericHTTPChannelProtocol,0,127.0.0.1] Unhandled Error Traceback (most recent call last): File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\twisted\web\server.py", line 255, in render body = resrc.render(self) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\klein\resource.py", line 210, in render d = defer.maybeDeferred(_execute) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\twisted\internet\defer.py", line 150, in maybeDeferred result = f(args, kw) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\klein\resource.py", line 204, in _execute kwargs) --- --- File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\twisted\internet\defer.py", line 150, in maybeDeferred result = f(args, kw) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\klein\app.py", line 128, in execute_endpoint return endpoint_f(self._instance, *args, *kwargs) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\klein\app.py", line 227, in _f return _call(instance, f, request, a, kw) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\klein\app.py", line 50, in _call result = f(*args, kwargs) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\rasa_nlu\server.py", line 82, in decorated return f(*args, *kwargs) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\site-packages\rasa_nlu\server.py", line 99, in decorated return f(args, kwargs) File "d:\rasa_core-master\rasa_core\server.py", line 91, in decorated return f(*args, **kwargs) File "d:\rasa_core-master\rasa_core\server.py", line 260, in parse request_params = json.loads(content.decode('utf-8', 'strict')) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\json__init__.py", line 354, in loads return _default_decoder.decode(s) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\json\decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Sibaprasad\Anaconda2\envs\py36\lib\json\decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2018-03-03 23:50:37+0530 [-] "127.0.0.1" - - [03/Mar/2018:18:20:37 +0000] "POST /conversations/default/parse HTTP/1.1" 500 10107 "-" "curl/7.58.0"

Curl Log Attached for your reference. Curl.txt

=================================================

curl -XPOST localhost:5005/conversations/default/parse -d '{"query":"hello there"}'

Server Error Log: 2018-03-04 09:44:35+0530 [-] 2018-03-04 09:44:35 ERROR main - Failed to decode json during parse request. Error: Expecting value: line 1 column 1 (char 0). Request content: 'b"'{query:hello there}'"'

SibaprasadM commented 6 years ago

Hi All,

putting request in below format works for me:

curl -XPOST localhost:5005/conversations/default/parse -d "{\"query\":\"hello there\"}"

artiberde27 commented 6 years ago

@SibaprasadM Did u got solution for http://localhost:5005/conversations/default/continue. My http://localhost:5005/conversations/default/parse is worked with get method post is not woking. But http://localhost:5005/conversations/default/continue is not work with any of get or post method.Below is my sample Django calling API

user_message = request.POST["text"]
    response = requests.get("http://localhost:5005/conversations/default/parse",params={"query":user_message})
        response = response.json()
        next_action = response.get("next_action")
         if next_action == "show_concert_reviews":
            response_text = "show_concert_reviews"# "Sorry will get answer soon" #get_event(entities["day"],entities["time"],entities["place"])
        elif next_action == "show_concert_reviews":
            response_text = "show_concert_reviews1"
        else:
            response_text = "show_concert_reviews2"

        print({"executed_action": next_action, "events": []})
        response1 = requests.post("http://localhost:5005/conversations/default/continue",data={"executed_action":next_action, "events": []})    

        response1 = response1.json()

This give below error for http://localhost:5005/conversations/default/continue
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/Twisted-16.2.0-py3.5.egg/twisted/web/server.py", line 234, in render
    body = resrc.render(self)
  File "/usr/local/lib/python3.5/site-packages/klein/resource.py", line 210, in render
    d = defer.maybeDeferred(_execute)
  File "/usr/local/lib/python3.5/site-packages/Twisted-16.2.0-py3.5.egg/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python3.5/site-packages/klein/resource.py", line 204, in _execute
    **kwargs)
--- <exception caught here> ---
  File "/usr/local/lib/python3.5/site-packages/Twisted-16.2.0-py3.5.egg/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python3.5/site-packages/klein/app.py", line 128, in execute_endpoint
    return endpoint_f(self._instance, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/klein/app.py", line 227, in _f
    return _call(instance, f, request, *a, **kw)
  File "/usr/local/lib/python3.5/site-packages/klein/app.py", line 50, in _call
    result = f(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/rasa_nlu/server.py", line 81, in decorated
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/rasa_core/server.py", line 126, in parse
    request.content.read().decode('utf-8', 'strict'))
  File "/usr/local/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0

And if i called this with get method it gave below 405 error 2018-03-08 23:44:11+0530 [-] "127.0.0.1" - - [08/Mar/2018:18:14:11 +0000] "GET /conversations/default/continue?executed_action=show_concert_reviews HTTP/1.1" 405 178 "-" "python-requests/2.18.4"

But this request works with curl.

Could you please help me out in this

SibaprasadM commented 6 years ago

@artiberde27

My server runs on python 3 For client i am using python 2.7 and below code snippet works for me ( both in parse and continue end points ):

s_url = 'http://localhost:5005/conversations/default/parse' payload = '{"query": "hi" }' response = urllib2.Request(s_url, payload, {'Content-Type': 'application/json'}) f = urllib2.urlopen(response) for x in f: resj = json.loads(x)

print(resj)

Primtek commented 6 years ago

Hi.. all same here!.. with rasa core 0.9.0 :(

both rasa_nlu and rasa_core are trained!..

serve.py

from future import absolute_import from future import division from future import print_function from future import unicode_literals

import logging

from bot_server_channel import BotServerInputChannel

from rasa_core.channels import HttpInputChannel from rasa_core import utils from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.channels.channel import UserMessage from rasa_core.channels.direct import CollectingOutputChannel from rasa_core.channels.rest import HttpInputComponent from flask import Blueprint, request, jsonify

logger = logging.getLogger(name)

def preprocessor(message_text): text = message_text.strip() return text

def run():

path to your NLU model

interpreter = RasaNLUInterpreter("models/current/nlu_model","config.yml",lazy_init=False)

# path to your dialogues models
agent = Agent.load("models/current/dialogue", interpreter=interpreter)

channel = BotServerInputChannel(agent)
agent.handle_channel(channel,message_preprocessor=preprocessor)

return agent

if name == 'main': utils.configure_colored_logging(loglevel="INFO") run() ~ [root@ai nluEZ]# python serve.py /usr/lib64/python2.7/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters 2018-07-03 08:10:48.338250: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2018-07-03 08:10:48 INFO tensorflow - Restoring parameters from models/current/nlu_model/intent_classifier_tensorflow_embedding.ckpt Using TensorFlow backend. 2018-07-03 08:10:48 INFO root - Started http server on port 5005 2018-07-03 08:10:48+0700 [-] Log opened. 2018-07-03 08:10:48+0700 [-] Site starting on 5005 2018-07-03 08:10:48+0700 [-] Starting factory <twisted.web.server.Site instance at 0x7f36a24835a8>

======

[root@ai nluEZ]# curl -XPOST localhost:5005/conversations/default/parse -d "{"query":"hey"}" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

405 Method Not Allowed

Method Not Allowed

The method is not allowed for the requested URL.

curl: (3) [globbing] unmatched close brace/bracket at pos 6 [root@ai nluEZ]#

please help me out from this problem

thanks a lot in advance

Regards Win

amanvars commented 6 years ago

@Primtek try using this: curl -XPOST localhost:5005/conversations/default/parse -d "{\"query\":\"hey\"}"

use backslash with query and hey

rameshjes commented 6 years ago

@amanvars I tried this. I am getting this error:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>
akelad commented 6 years ago

Please create a new issue

legendof-selda commented 5 years ago

I think it has something to do with windows in insomnia send the post as a JSON body with content

{
   "query": "Hi"
}

in curl give curl -X POST localhost:5005/conversations/default/respond -d "{\"query\":\"hi\"}" | python -mjson.tool

Mormukut11 commented 5 years ago

Hi, how can we integrate Cortana and Siri with RASA?