Accessing RASA NLU only server from python code using API

Hi @sandeeppandey456 ,

The following should work, it looks like the issue was that you used "message" in your payload instead of "text":

text = str(input("Enter the message"))
payload = {"sender": "Rasa","text": text})
headers = {'content-type': 'application/json'}
response = requests.post('http://10.101.1.239:5005/model/parse', json=payload, headers=headers)
response = response.json()
print("response :\n",response)

That being said, I’m not sure the server will send back the sender_id bit. You could try with message_id: Rasa Open Source Documentation

Alternatively, you could load a NLU model directly in your code: see Using nlu model with Interpreter.load in Rasa 3.0 - #8 by isgaal

Hope that helps

1 Like