Using NLU only with rasa-x

We need to use the /model/parse and /webhooks/rest/webhook endpoints in a scalable environment, so I deployed rasa-x using the official helm chart. I have seen that rasa-x provides conversation endpoints like /api/conversations/{conversation_id}/messages but how do I use NLU-only with rasa-x? (We need the same functionallity that /model/parse provides)

I have seen you can target the rasa API in rasa-x with /core and /core/model/parse exists. I was able to get the bearer token with /api/auth, which worked for the /api/conversations/{conversation_id}/messages endpoint, the /core/model/parse endpoint, however, gives me a code 500. Looking into the rasa-production pod’s logs:

[2020-04-03 10:01:05 +0000] [1] [ERROR] Exception occurred while handling uri: 'http://<some-ip>/model/parse'
Traceback (most recent call last):
  File "/opt/venv/lib/python3.6/site-packages/sanic/", line 976, in handle_request
    response = await response
  File "/opt/venv/lib/python3.6/site-packages/rasa/", line 159, in decorated
  File "/opt/venv/lib/python3.6/site-packages/sanic_jwt/", line 486, in is_authenticated
    is_valid, *_ = self._verify(request)
  File "/opt/venv/lib/python3.6/site-packages/sanic_jwt/", line 348, in _verify
    payload = self._decode(token, verify=verify)
  File "/opt/venv/lib/python3.6/site-packages/sanic_jwt/", line 172, in _decode
  File "/opt/venv/lib/python3.6/site-packages/jwt/", line 92, in decode
    jwt, key=key, algorithms=algorithms, options=options, **kwargs
  File "/opt/venv/lib/python3.6/site-packages/jwt/", line 156, in decode
    key, algorithms)
  File "/opt/venv/lib/python3.6/site-packages/jwt/", line 216, in _verify_signature
    raise InvalidAlgorithmError('The specified alg value is not allowed')
jwt.exceptions.InvalidAlgorithmError: The specified alg value is not allowed

So I tried to use the jw-token authentication described as here:


import jwt
import requests
body = {
    "message": "Hi"
payload = {"user": {"username": "me", "role": "admin",}}
signed = jwt.encode(payload, "jwtSecret", algorithm='HS256')

headers = {
    "Authorization": "Bearer {}".format(signed),
    "Content-Type": "application/json"

r ="{ADDRESS}core/model/parse",

I get an authentication error:

{'version': '1.8.1', 'status': 'failure', 'message': 'User is not authenticated.', 'reason': 'NotAuthenticated', 'details': {}, 'help': '', 'code': 401}
    "code": 401,
    "details": {},
    "help": "",
    "message": "User is not authenticated.",
    "reason": "NotAuthenticated",
    "status": "failure",
    "version": "1.8.1"

Did I get something wrong with the call? I placed jwtSecret in the values.yaml file of the helm setup. Rasa version is 1.8.1, Rasa-x is 0.26.3. Is there maybe a more rasa-xish way to get /model/parse functionallity?

Hey @alxbar here is an example of how you would use only NLU with Rasa X:

curl -XPOST -H "Authorization: Bearer ${JWT}"{}

Where {} should be the user message, and ${JWT} is the authorization token, which you can get from this endpoint:

curl -XPOST -d '{"username":"me", "password":"password"}' 
1 Like

Thanks! That worked

Hello @akelad, have the specs around the /logs endpoint changed? I get a zsh: no matches found response for this.

I tried the following call -

curl -XPOST -H "Authorization: Bearer <myJWTToken>" <myURL>/api/projects/default/logs?q=Hello%20%my%20%name%20%is%20%Ganesh

Am I formatting this incorrectly?

Any update on the above? :slight_smile: