[solved] Where to register the action

No registered Action found for name ‘action_chitchat’. while it is already in my domain.

Encountered an exception while running action ‘action_chitchat’. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code. 2018-09-25 20:03:15 ERROR rasa_core.processor - Failed to execute custom action. Traceback (most recent call last): File “rasa_core/processor.py”, line 323, in _run_action events = action.run(dispatcher, tracker, self.domain) File “rasa_core/actions/action.py”, line 348, in run raise Exception(“Failed to execute custom action.”)

Hi,

I faced as similar issue. Are you sure you imported: from rasa_core_sdk import Action?

Since the import from rasa_core.actions import Action is not compatible to every version I think.

1 Like

yes I have used that

from future import absolute_import from future import division from future import print_function from future import unicode_literals from rasa_core_sdk import Action

import logging

import requests import typing from typing import List, Text, Optional, Dict, Any

from rasa_core import events from rasa_core.constants import DOCS_BASE_URL, DEFAULT_REQUEST_TIMEOUT from rasa_core.utils import EndpointConfig

class ActionChitchat(Action): “”“Returns the chitchat utterance dependent on the intent”""

def name(self):
    return "action_chitchat"

def run(self, dispatcher, tracker, domain):

    intent = tracker.latest_message['intent'].get('name')

    # retrieve the correct chitchat utterance dependent on the intent
    if intent in ['Greet','close']:
        dispatcher.utter_template('utter_' + intent, tracker)
    return []

class Action(object): “”“Next action to be taken in response to a dialogue state.”""

def name(self):
    # type: () -> Text
    """Unique identifier of this simple action."""

    raise NotImplementedError

def run(self, dispatcher, tracker, domain):
    # type: (Dispatcher, DialogueStateTracker, Domain) -> List[Event]
    """
    Execute the side effects of this action.

    Args:
        dispatcher (Dispatcher): the dispatcher which is used to send
            messages back to the user. Use ``dipatcher.utter_message()``
            or any other :class:`Dispatcher` method.
        tracker (DialogueStateTracker): the state tracker for the current
            user. You can access slot values using
            ``tracker.get_slot(slot_name)`` and the most recent user
            message is ``tracker.latest_message.text``.
        domain (Domain): the bot's domain

    Returns:
        List[Event]: A list of :class:`Event` instances
    """

    raise NotImplementedError

def __str__(self):
    return "Action('{}')".format(self.name())

did you start the action server? https://rasa.com/docs/core/customactions/#custom-actions

yes I did, issue is resovled, the path was not correct.

Hello, I have the same problem and have solved it.My problem is that registered in domain.yml is the path of action, not the name of action itself. You should register the custom name of action (also in story.md).I hope it helps