ben121
ben121

Reputation: 897

RASA - rasa run actions - localhost issues

I am learning Rasa using the RASA masterclass youtube channel. https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ

It has all worked until it has come to loading actions. Each time I use rasa run actions in the command prompt (the first of the two actions) the program gets stuck and I have to manually kill it. When I use rasa shell --endpoints endpoints.yml, bot works however as I keep encountering when I add in a custom action the server returns cannot connect to localhost like in the bottom example. The question is how to I get passed this issue.

*Please ask for additional info

:enter image description here

my actions.py looks like the below:

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet



class ActionFacilitySearch(Action):

    def name(self) -> Text:
        return "action_facility_search"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        facility = tracker.get_slot("facility_type")
        address = "300 Hyde St, San Francisco"
        dispatcher.utter_message("Here is the address of the {}:{}".format(facility, address))

        return []

in domain.yml, for the actions section I have;

actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_ask_location
- action_facility_search

and in endpoints.yml, most is #'d out but the active bit is:

action_endpoint:
  url: "http://localhost:9000/webhook"

Upvotes: 3

Views: 8393

Answers (6)

In terminal 1 run

rasa actions

In terminal 2 run Check you have the model inplace inside the models folder if it is not there use

rasa train

Then run

rasa shell --endpoints endpoints.yml

Upvotes: 0

Talha Shaikh
Talha Shaikh

Reputation: 45

By looking at the given image, I am assuming that you want to run the action server on port 9000.
If you do want to run action server on port 9000, then you need to make these changes:

endpoints.yml:

action_endpoint:
  url: "http://localhost:9000/webhook"

Command to run action server:

rasa run actions -p 9000 --debug

user --debug option too check is there issue in action file.

Upvotes: 0

Ankit Singh
Ankit Singh

Reputation: 347

I solve by using the following commands

rasa run actions

Then a second window for either:

rasa x

this then worked as it should.

Upvotes: 0

VIMAL KUMAR
VIMAL KUMAR

Reputation: 1

it looks like your custome actions server couldn't able to connect with the endpoint server which is mentioned in endpoints.yml

While running actions.py provide the port number as rasa run actions -p portnumber

Make sure the port number you give here is mentioned in endpoints.yml

Upvotes: 0

ben121
ben121

Reputation: 897

Very simple answer in the end. I needed to run two commands windows. The first one for:

rasa run actions

Then a second window for either:

rasa x

or

rasa shell

this then worked as it should.

Upvotes: 7

vishal bareja
vishal bareja

Reputation: 21

Please do not change endpoints.yml with any other port for action_endpoint

Please check with 5055 port it was working perfectly.

action_endpoint:
  url: "http://localhost:5055/webhook"

Your action server running on 5055 port. if you want it to set 9000 then change it from rasa core backend request.

Upvotes: 2

Related Questions