[SOLVED] HTTP APIs do not work

All endpoint examples in RASA doc do not work. I run rasa core server as following

python -m rasa_core.run  -d models/dialogue -u models/nlu/default/so_health --endpoints endpoints.yml --credentials credentials.yml -o out.log

Then I try curl http://172.17.0.2:5005/conversations/bayram/tracker or http://172.17.0.2:5005/conversations which returns not found (404 ) response. I guess the doc is not up-to-date. Any other documentation on Rasa HTTP APIs?

try to enable apis - --enable_api

Thanks for quick response. It worked. I have another question.

As for " POST /conversations/ ( str: sender_id ) /respond" the documentation says that “This endpoint will be removed in the future. Rather consider using the RestInput channel.” . I managed to get response using /webhooks/rest/webhook and sending corresponding body json text.

Do you know how to use ResInput for other endpoints too?

only the respond API will be removed. The rest remains as-is as far i am aware

@souvikg10, how to use this enable_api inside teh python script rather than using in commandline?

How are you executing the python API?

like below

nlu_interpreter = RasaNLUInterpreter(’./models/nlu/default/weathernlu’)

action_endpoint = EndpointConfig(url=“http://localhost:5055/webhook”)

agent = Agent.load(’./models/dialogue’, interpreter = nlu_interpreter, action_endpoint = action_endpoint)

input_channel = SlackInput(SLACK_BOT_TOKEN)

agent.handle_channels([input_channel], int(port), serve_forever=True)

@souvikg10 any suggestion? am i doing something not in the right way?

I think, if you need to import server.py and run server.create_app

check the code in run.py

app = server.create_app(initial_agent,
                                cors_origins=cors,
                                auth_token=auth_token,
                                jwt_secret=jwt_secret,
                                jwt_method=jwt_method)
1 Like

How do I add external NLG in the custom server code written in python.

Example:

from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig

interpreter = RasaNLUInterpreter('NLU/models/default/model_1')
action_endpoint = EndpointConfig(url='http://localhost:3001/webhook')
dialogue_model = 'CORE/models' 

agent = Agent.load(dialogue_model,interpreter=interpreter, action_endpoint=action_endpoint)

I want to add external NLG while loading the agent, how do I do that?