[SOLVED] How to specify action_endpoints

I have created a simple bot. I also have a simple HTTP server working on another host and a couple of custom actions on that server. I specified the action endpoint in my enpoints.yml file as following

action_endpoint:
  url: "http://172.17.0.3:8080/" 

My talk.py file is

def talk_with_nlu():
    agent = Agent.load('models/dialogue', interpreter='./models/nlu/default/simplebotnlu/', action_endpoint='./endpoints.yml')
    print("Your bot is ready to talk! Type your messages here or send 'stop'")
    while True:
        a = input()
        if a == 'stop':
            break
        responses = agent.handle_message(a)
        for response in responses:
            print(response["text"])


talk_with_nlu()

When I run this script I don’t see any request post to my HTTP server. I also tried to run by

python -m rasa_core.run -d models/dialogue -u models/nlu/default/simplebotnlu --endpoints ./endpoints.yml

but it also does not post anything to my remote server.

Any idea?

References:

  1. https://rasa.com/docs/core/api/agent/
  2. https://rasa.com/docs/core/customactions/
1 Like

Never mind, worked. I simply need to specify an action which is not defined in stories.

[Solved]hey could you explain how you did that , it seems i am stuck creating custom actions in 0.11.3 :frowning:

You simply run a (simple) HTTP server, say, on 172.17.0.3:8080, which would process incoming requests, in particular POST requests since RASA sends POST requests (see documentation). The body of the requests is in JSON format and so your response should also be in JSON format.

Define an intent in your domain file, for example custom.intent. Do not type anything related to the custom.intent in your stories file. When RASA detects this intent and finds nothing related to this intent in your stories file it automatically sends a requests to your remote action server with all necessary information packed in JSON format. The rest is up to you how to process it and what to response.

Also do not forget to specify the endpoint in your python file when you create an agent, e.g.,

from rasa_core.utils import EndpointConfig
...
agent = Agent.load('./models/dialogue',
        interpreter=RasaNLUInterpreter('./models/nlu/default/my_bot/'),
        action_endpoint=EndpointConfig(url="http://172.17.0.3:8080/"))
...
6 Likes

Endpointconfig was what i needed . Thanks , my problem is solved

Hey, how do I specify NLG server in agent.load()?