Search code examples
rasarasa-nlurasa-corerasa-xrasa-sdk

No registered action found for name 'action_redirect_to_scholarship' in rasa action.py


I am making a chatbot for my college as a project using RASA. I am planning to train this bot accordingly but at the latest I am facing a problem related to actions.py file. Well you see that, I want to bot to redirect to particular website, when the user asks about "Scholarships" but instead it gives error. Like below (in action.py's terminal):

> 2024-06-08 22:51:22 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
> 2024-06-08 22:51:22 INFO     rasa_sdk.endpoint  - Starting plugins...
> 2024-06-08 22:51:22 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
> 2024-06-08 22:53:02 ERROR    rasa_sdk.endpoint  - No registered action found for name 'action_redirect_to_scholarship'.

I tried whatever things YouTube and Google recommended me. Things like:

  1. Ensuring that the action name action_redirect_to_scholarship matches exactly in actions.py, domain.yml, and any other relevant files (e.g., stories, rules).
  2. The utter_redirect_to_scholarship response is aligned properly under responses.
  3. Ensure you are using the correct version of Rasa that supports the domain version "3.1".
  4. They are also in same directory

Errors in rasa server:

Your input ->  scholarship
2024-06-08 22:53:02 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_redirect_to_scholarship'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "C:\Users\Prath\Desktop\ColBot\rasa_venv\lib\site-packages\rasa\core\actions\action.py", line 780, in run
    response: Any = await self.action_endpoint.request(
  File "C:\Users\Prath\Desktop\ColBot\rasa_venv\lib\site-packages\rasa\utils\endpoints.py", line 184, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 404, Not Found, body='b'{"error":"No registered action found for name \'action_redirect_to_scholarship\'.","action_name":"action_redirect_to_scholarship"}''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Prath\Desktop\ColBot\rasa_venv\lib\site-packages\rasa\core\processor.py", line 982, in _run_action
    events = await action.run(
  File "C:\Users\Prath\Desktop\ColBot\rasa_venv\lib\site-packages\rasa\core\actions\action.py", line 810, in run
    raise RasaException(
rasa.shared.exceptions.RasaException: Failed to execute custom action 'action_redirect_to_scholarship'

actions.py Above is my actions.py

Stories.yml:

version: "3.1"

stories:

- story: happy path
  steps:
  - intent: greet
  - action: utter_greet
  - intent: mood_great
  - action: utter_happy

- story: sad path 1
  steps:
  - intent: greet
  - action: utter_greet
  - intent: mood_unhappy
  - action: utter_cheer_up
  - action: utter_did_that_help
  - intent: affirm
  - action: utter_happy

- story: sad path 2
  steps:
  - intent: greet
  - action: utter_greet
  - intent: mood_unhappy
  - action: utter_cheer_up
  - action: utter_did_that_help
  - intent: deny
  - action: utter_goodbye

- story: ask branch
  steps:
  - intent: greet
  - action: utter_greet
  - intent: branches
  - action: utter_branches

- story: redirect to scholarship site
  steps:
  - intent: check_scholarships
  - action: action_redirect_to_scholarship

**My nlu.yml **:

version: "3.1"

nlu:
- intent: greet
  examples: |
    - hey
    - hello
    - hi
    - hello there
    - good morning
    - good evening
    - moin
    - hey there
    - let's go
    - hey dude
    - goodmorning
    - goodevening
    - good afternoon

- intent: goodbye
  examples: |
    - cu
    - good by
    - see you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later

- intent: affirm
  examples: |
    - yes
    - y
    - indeed
    - of course
    - that sounds good
    - correct

- intent: deny
  examples: |
    - no
    - n
    - never
    - I don't think so
    - don't like that
    - no way
    - not really

- intent: mood_great
  examples: |
    - perfect
    - great
    - amazing
    - feeling like a king
    - wonderful
    - I am feeling very good
    - I am great
    - I am amazing
    - I am going to save the world
    - super stoked
    - extremely good
    - so so perfect
    - so good
    - so perfect

- intent: mood_unhappy
  examples: |
    - my day was horrible
    - I am sad
    - I don't feel very well
    - I am disappointed
    - super sad
    - I'm so sad
    - sad
    - very sad
    - unhappy
    - not good
    - not very good
    - extremely sad
    - so sad

- intent: bot_challenge
  examples: |
    - are you a bot?
    - are you a human?
    - am I talking to a bot?
    - am I talking to a human?
    - tell me about you?
    - what is your name?
    - about you

- intent: branches
  examples: |
    - what are the branches available in the college?
    - branches of the college
    - branches

- intent: check_scholarships
  examples: |
    - tell me about scholarships
    - what scholarships are available?
    - scholarship details
    - how can I get a scholarship?
    - tell me about scholarships available in St John's College of Engineering and Management
    - tell me about scholarships available in this college

domain.yml:

version: "3.1"

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - branches
  - check_scholarships

responses:
  utter_greet:
    - text: "Hey! How are you?"

  utter_cheer_up:
    - text: "Here is something to cheer you up:"
      image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_did_that_help:
    - text: "Did that help you?"

  utter_happy:
    - text: "Great, carry on!"

  utter_goodbye:
    - text: "Bye"

  utter_branches:
    - text: |
        Branches available in St. John College of Engineering & Management are:<br>
        1. Civil Engineering<br>
        2. Computer Engineering<br>
        3. Information Technology<br>
        4. Electronics & Computer Science<br>
        5. Mechanical Engineering<br>
        6. Artificial Intelligence/Machine Learning<br>
        7. Data Science

  utter_iamabot:
    - text: |
        COLLEGE ENQUIRY BOT, also known as COLLEGE-E-BOT, is an AI-powered virtual assistant designed to assist you with queries related to colleges, courses, achievements, and other relevant information. It is programmed to provide helpful responses based on the queries you ask. It is made by Prathamesh Patil from S.E. A.I.M.L. COLLEGE-E-BOT can fetch information about various college branches, details about specific colleges, their achievements, placements, and more. It aims to provide you with accurate and relevant information to aid in your college decision-making process. If you have any questions or need assistance, feel free to ask COLLEGE-E-BOT, and it will do its best to help you!

  utter_redirect_to_scholarship:
    - text: "Redirecting to site for more information: [Click here](https://www.aldel.in/scholarship.html)"

actions:
  - action_redirect_to_scholarship

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

my endpoints.yml:

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

i have absolutely no idea of how to solve this. I would appreciate some help here.


Solution

  • Even I also faced the same issue, so after a bunch of trials, I finally found the solution. My case is a little different because iam using docker container to run rasa (from rasa/rasa base image) and rasa_sdk (from rasa/rasa-sdk). Here I have 2 containers. Ok, let's come to the solution. The command is

    python -m rasa_sdk --actions actions

    This should work for you. If you are also using docker the run

    CMD ["run", "python", "-m", "rasa_sdk", "--actions"  " actions"]
    

    Reason for the problem:The reason is pretty simple rasa_sdk is unable to locate the actions