question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom action not working

See original GitHub issue

Rasa Core version: 0.11.7

Python version: 3.6.5

Operating system : ubuntu 16.04

Issue: Custom action not working

Content of actions.py :

from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet

class ActionCheckRestaurants(Action):
   def name(self):
      return "action_check_restaurants"

   def run(self, dispatcher, tracker, domain):
   
     dispatcher.utter_message("nothing ")
     if tracker.get_slot('city'):
         dispatcher.utter_message("check restaurant action being called ..")
     else:
         dispatcher.utter_message("no restaurant being called")
     return  [ ]

Content of endpoints.yml file :

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

Output of debug mode

I am looking for restaurants in new york city
2018-10-04 15:58:58 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default'
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Received user message 'I am looking for restaurants in new york city' with intent '{'name': 'findRestaurantsByCity', 'confidence': 0.8807270526885986}' and entities '[{'start': 32, 'end': 40, 'value': 'new york', 'entity': 'city', 'confidence': 0.895800285339971, 'extractor': 'ner_crf'}]'
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 7 events
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Current slot values: 
	city: new york
2018-10-04 15:58:58 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, {}, {'slot_city_0': 1.0, 'intent_findRestaurantsByCity': 1.0, 'prev_action_listen': 1.0, 'entity_city': 1.0}, {'slot_city_0': 1.0, 'prev_action_check_restaurants': 1.0, 'intent_findRestaurantsByCity': 1.0, 'entity_city': 1.0}, {'slot_city_0': 1.0, 'intent_findRestaurantsByCity': 1.0, 'prev_action_listen': 1.0, 'entity_city': 1.0}]
2018-10-04 15:58:58 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-10-04 15:58:58 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Predicted next action 'action_check_restaurants' with prob 0.61.
2018-10-04 15:58:58 ERROR    rasa_core.processor  - Encountered an exception while running action 'action_check_restaurants'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2018-10-04 15:58:58 ERROR    rasa_core.processor  - The model predicted the custom action 'action_check_restaurants' but you didn't configure an endpoint to run this custom action. Please take a look at the docs and set an endpoint configuration. https://rasa.com/docs/core/customactions/
Traceback (most recent call last):
  File "/home/ramesh/anaconda3/lib/python3.6/site-packages/rasa_core/processor.py", line 324, in _run_action
    events = action.run(dispatcher, tracker, self.domain)
  File "/home/ramesh/anaconda3/lib/python3.6/site-packages/rasa_core/actions/action.py", line 305, in run
    "".format(self.name(), DOCS_BASE_URL))
Exception: The model predicted the custom action 'action_check_restaurants' but you didn't configure an endpoint to run this custom action. Please take a look at the docs and set an endpoint configuration. https://rasa.com/docs/core/customactions/
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Action 'action_check_restaurants' ended with events '[]'
2018-10-04 15:58:58 DEBUG    rasa_core.policies.memoization  - Current tracker state [{}, {'slot_city_0': 1.0, 'intent_findRestaurantsByCity': 1.0, 'prev_action_listen': 1.0, 'entity_city': 1.0}, {'slot_city_0': 1.0, 'prev_action_check_restaurants': 1.0, 'intent_findRestaurantsByCity': 1.0, 'entity_city': 1.0}, {'slot_city_0': 1.0, 'intent_findRestaurantsByCity': 1.0, 'prev_action_listen': 1.0, 'entity_city': 1.0}, {'slot_city_0': 1.0, 'prev_action_check_restaurants': 1.0, 'intent_findRestaurantsByCity': 1.0, 'entity_city': 1.0}]
2018-10-04 15:58:58 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-10-04 15:58:58 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Predicted next action 'action_listen' with prob 0.99.
2018-10-04 15:58:58 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'
127.0.0.1 - - [2018-10-04 15:58:58] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 122 0.023412

I tried all the existing solutions, but nothing is working in my case. Can anyone please help with this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
lucasR23commented, Feb 11, 2019

thanks very much. its resolved.

how did u resolve this issue?

I had the same issue. i solved configuring the endpoint URL in the python script like that:

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

core_endpoint_config = EndpointConfig(url='http://localhost:5055/webhook')

interpreter = RasaNLUInterpreter('models/current/nlu')
agent = Agent.load('models/current/dialogue', interpreter=interpreter,
                                    action_endpoint = core_endpoint_config)

while True:
    a = input("Eu: ")
    messages.append(a)
    if a == 'stop':
        break
    responses = agent.handle_message(a)
    for r in responses:
        answer = r.get("text")
        messages.append(answer)
        print("Bot: " + answer)

i hope that helps

1reaction
akeladcommented, Oct 5, 2018

are you passing the endpoints.yml file to rasa core when starting it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom action is not running - Stack Overflow
The installer doesn't seem to be running. Here's the lines in the WXS file that define the custom action: <CustomAction Id="GetConfigProperties" ...
Read more >
Custom actions no longer working - Atlassian Community
To make custom actions work, you need to make sure "Open in a separate window" is NOT ticked. This is found in the...
Read more >
Custom action not working properly - Glide Community
I have a custom action on add a new item (Requests sheet) which has two columns, pickup (type boolean in Glide table) and...
Read more >
Custom action not working - Rasa Community Forum
Hi, I am trying to run one custom action which is provided default in rasa x. It's just a hello world. When I...
Read more >
Why a Custom Action May Not Run - Visual Studio Setup
Another common reason exists for binary custom actions: missing dependencies. When a binary custom action appears to work on your developer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found