/model/parse api call missing?

I’m following the webkit-voice-demo project by @koaning here - RasaHQ/webkit-voice-demo: This is a project that shows how to integrate webkit voice with Rasa. (github.com)

I’m stuck on the API call to my rasa server. It’s making a call to http://localhost:5005/model/parse and my server is returning a 404.

If I hit my server straight with no path (http://localhost:5005), I get the hello message so I know it is indeed running -

Hello from Rasa: 2.6.2

Any ideas? It looks like the /model/parse endpoint is still in the docs.

Am I missing something?

1 Like

That’s strange. Could you share the logs and the httpie/curl request that you’re making? I’m wondering if the issue is that you’re making a GET request instead of a POST one.

1 Like

Sure thing. Here’s everything I see and tried -

Here’s the browser console logs -

(index):34 This is a test.
(index):35 Confidence: 0
(index):44 POST http://localhost:8000/api/ 500 (Internal Server Error)
recognition.onresult @ (index):44
VM7:1 Uncaught (in promise) SyntaxError: Unexpected token I in JSON at position 0

The uvicorn console spits out this -

uvicorn app:app --reload --port 8000
INFO:     Uvicorn running on (Press CTRL+C to quit)
INFO:     Started reloader process [28105] using statreload
INFO:     Started server process [28107]
INFO:     Waiting for application startup.
INFO:     Application startup complete.   
INFO: - "GET / HTTP/1.1" 200 OK
INFO: - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO: - "POST /api/ HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 371, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 59, in __call__
    return await self.app(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/middleware/cors.py", line 86, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/middleware/cors.py", line 142, in simple_response
    await self.app(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/routing.py", line 580, in __call__
    await route.handle(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/routing.py", line 241, in handle
    await self.app(scope, receive, send)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/routing.py", line 52, in app
    response = await func(request)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/fastapi/routing.py", line 202, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool
    return await loop.run_in_executor(None, func, *args)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./app.py", line 45, in post_attempt
    return rq.post(url, json=body).json()
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/jwheat/anaconda2/envs/rasa260/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I changed the api call line to this -

    url = "http://localhost:5005/model/parse"
    results = rq.post(url, json=body)

And as you can see I get a 404 error -

INFO:     Application startup complete.
<!DOCTYPE html><html lang=en><meta charset=UTF-8><title>⚠️ 404 — Not Found</title>
        html { font-family: sans-serif }
        h2 { color: #888; }
        .tb-wrapper p { margin: 0 }
        .frame-border { margin: 1rem }
        .frame-line > * { padding: 0.3rem 0.6rem }
        .frame-line { margin-bottom: 0.3rem }
        .frame-code { font-size: 16px; padding-left: 4ch }
        .tb-wrapper { border: 1px solid #eee }
        .tb-header { background: #eee; padding: 0.3rem; font-weight: bold }
        .frame-descriptor { background: #e2eafb; font-size: 14px }
<h1>⚠️ 404 — Not Found</h1><p>Requested URL /model/parse not found

INFO: - "POST /api/ HTTP/1.1" 200 OK

To make sure it was finding the server, I changed the url to /webhooks/rest/webhook to see if I get a different error, and it returns no errors so I know it’s hitting my server.

INFO:     Application startup complete.
INFO: - "POST /api/ HTTP/1.1" 200 OK

Strange, right?

I ran a typical rasa train, do I need to do just a rasa train nlu or something maybe?

1 Like

Try run

rasa run --enable-api

Yep, I already am, I can interact with my rasa server with my web chat component so I know it’s running the api.

This is the complete command I’m running FWIW -

rasa run -m models --enable-api --log-file out.log --cors "*" --endpoints endpoints-local.yml --debug

I figured it out - meaning it’s working now.

I stopped my rasa server, and hit refresh on my browser with http://localhost:5005 and I STILL got the Hello message, which clearly shouldn’t have happened.

I apparently already had a rasa server running somewhere else, which occasionally happens some times and since I’m on Wonderful Windows, I have to go to Task Manager and kill all the python 3.7 processes. Once I did that, I spun up the Rasa server again, ran uvicorn and it works now.

Couple strange things about that -

1 - I didn’t get a port conflict message when I fired up the 2nd rasa server

2 - if 2 were running you’d think one of them could serve up the api call

All is well now though.

1 Like