0.14.6—rasa_nlu
0.13.5 – rasa core
0.12.2 – rasa-core-sdk
I have built a weather chat bot and then trained it.
I need to integrate it with a simple web app .i thought of using api’s and used
“python -m rasa_core.run --enable_api -d models/dialogue -u models/nlu/default/weathernlu -o out.log --endpoints endpoints.yml”.
I want to test it with curl. by giving a '{“query”:‘hello"}’.How to do it?
and more importantly what is the url of this core server that i need to give to the frontend guys so that they can do post and get requests??
In your web app you could use axios: https://github.com/axios/axios
axios.post(‘localhost:5005/conversations/default/respond’, JSON.stringify({ ‘query’: ‘hello’ }))
.then(response => console.log(“fromRasa”, response))
.catch(error => console.error(‘err’, error));
Hi,
Sorry for late reply. Simply in the credentials file mention ‘rest’. With the latest version of rasa by default the rest api’s are activated.There is already a ‘rest’ written in the credentials file.
Hi,
Currently I am using Rasa 1.3.X from git hub.
In the credentials.yml simply mention “rest:”.
This will enable the rest channel.
When you first create the “rasa init” project, it will also create a credentials file with rest in it.
Check the rasa command prompt from where you have given Rasa run and actions rum. If there is an error, it will get displayed there.
Sometimes due to lack of stories, the bot may give back “action_listen”, which in turn is an empty response with sender id key. Check this scenario as well.
It seems working. However, I’m confused here about 5005 port and 5055 port in endpoints.yml . 5005 alone seems working for both nlu (localhost:5005/model/parse) and action(localhost:5005/webhooks/rest/webhook). Then what the 5055 port for, when to use it?
You hit the 5005 port with the user message.Then depending on the intent, to perform the action, rasa nlu will hit the core server which will run in 5055(depending on what you specify in the endpoints file.).
Hit In postman - http://localhost:5005/webhooks/rest/webhook with a POST request.
In the body -> raw -> select JSON , then write -
{
“sender”: “rasa”,
“message”: “hello how r u”
}
with python code -
data = { “sender”: "rasa,
“message”: “Hello How r u”,
}
data = json.dumps(data)
rasa_api_endpint = “http://localhost:5005/webhooks/rest/webhook”
res = requests.post(url = rasa_api_endpint, data = data)\
@vi.kumar thanks for the exact answer which helps beginners to undertand.
@All: Pzl enable api end point using command ‘rasa run --enable-api’ at your project directory before trying curl or postman commands.