/model/parse api call missing? - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum
👋 Introducing the Rasa Playground
/model/parse api call missing?
post by jonathanpwheat on Jun 7, 2021
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?
post by koaning on Jun 7, 2021
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.
post by jonathanpwheat on Jun 7, 2021
Sure thing. Here’s everything I see and tried -
Here’s the browser console logs -
Listening...
(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 http://127.0.0.1:8000 (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: 127.0.0.1:56578 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:56578 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63618 - "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/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/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)
print(results.text)
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>
<style>
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 }
</style>
<h1>⚠️ 404 — Not Found</h1><p>Requested URL /model/parse not found
INFO: 127.0.0.1:57022 - "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: 127.0.0.1:57784 - "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?
post by Dustyposa on Jun 7, 2021
Try run
rasa run --enable-api
post by jonathanpwheat on Jun 8, 2021
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
post by jonathanpwheat on Jun 8, 2021
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.