RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.97k stars 4.64k forks source link

Custom action endpoint configuration failed #6425

Closed ArcticLilacFox closed 3 years ago

ArcticLilacFox commented 4 years ago

Rasa version: Rasa 1.10.10 Rasa SDK version (if used & relevant):

Rasa X version (if used & relevant):

Python version: Python 3.6.10 :: Anaconda, Inc. Operating system (windows, osx, ...): Windows 10 Home Issue: I tried to configure the endpoint for my custom action, but i am ultimately unsuccessful, no matter what i try. I had no problems during rasa train . I tried the --endpoint command, which did not help either. When I run rasa shell , I get the following error after triggering my custom action:

Error (including full traceback):

2020-08-15 10:37:41 ERROR    rasa.core.actions.action  - The model predicted the custom action 'action_get_db', but you didn't configure an endpoint to run this custom action. Please take a look at the docs and set an endpoint configuration via the --endpoints flag. https://rasa.com/docs/rasa/core/actions
2020-08-15 10:37:41 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_get_db'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

Command or request that led to error:

rasa shell

Content of domain file (domain.yml) (if relevant):

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - large_manufacturer
  - small_service

  actions:
    - action_get_db

responses:
  utter_greet:
  - text: "Greetings! This is Sheldon! I'm here to help to you with your ERP Lab interview training. To continue this session please choose a 'company-size' and 'company-type'. for example 'I choose a (company-size) (company-type) company'. Company sizes are small, medium and large. Company types are manufacturer, service and retail. Let's start!"

  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_iamabot:
  - text: "I am a bot, powered by Rasa."

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

Content of endpoints file (endpoints.yml)

# This file contains the different endpoints your bot can use.

# Server where the models are pulled from.
# https://rasa.com/docs/rasa/user-guide/configuring-http-api/#fetching-models-from-a-server/

#models:
#  url: http://my-server.com/models/default_core@latest
#  wait_time_between_pulls:  10   # [optional](default: 100)

# Server which runs your custom actions.
# https://rasa.com/docs/rasa/core/actions/#custom-actions/

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

# Tracker store which is used to store the conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/api/tracker-stores/

#tracker_store:
#    type: redis
#    url: <host of the redis instance, e.g. localhost>
#    port: <port of your redis instance, usually 6379>
#    db: <number of your database within redis, e.g. 0>
#    password: <password used for authentication>
#    use_ssl: <whether or not the communication is encrypted, default false>

#tracker_store:
#    type: mongod
#    url: <url to your mongo instance, e.g. mongodb://localhost:27017>
#    db: <name of the db within your mongo instance, e.g. rasa>
#    username: <username used for authentication>
#    password: <password used for authentication>

# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/api/event-brokers/

#event_broker:
#  url: localhost
#  username: username
#  password: password
#  queue: queue

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

Content of actions file (actions.py)

# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/core/actions/#custom-actions/

# This is a simple example for a custom action which utters "Hello World!"

 from typing import Any, Text, Dict, List

 from rasa_sdk import Action, Tracker
 from rasa_sdk.executor import CollectingDispatcher
#
#class ActionHelloWorld(Action):

#     def name(self) -> Text:
#         return "action_hello_world"
#
#     def run(self, dispatcher: CollectingDispatcher,
#             tracker: Tracker,
#             domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
#
#         dispatcher.utter_message(text="Hello World!")
#
#         return []

 class ActionGetDb(Action):

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

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

             response = requests.get("https://github.com/ArcticLilacFox/companies/blob/master/db.json").json()

        entities = tracker.latest_message['entities']
         print("Your selection is ", entities)
         state = None
         for e in entities:

             if e['entity'] == "companysize" and "companytype":
                state = e['value']

         dispatcher.utter_message(text="Hello World!")

         return []

Content of nlu file (nlu.md)

## intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there

## intent:goodbye
- bye
- goodbye
- see you around
- see you later

## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?

## intent:large_manufacturer
- I choose a [large](companysize) [manufacturer](companytype) company.
- I choose a [large](companysize) [manufacturer](companytype)
- I choose a [large](companysize) [manufacturing](companysize) company
- I choose [large](companysize) [manufacturer](companytype)
- I choose a [big](companysize) [manufacturer](companytype) company
- I choose a [large](companysize) [manufacture](companytype) company
- [large](companysize) [manufacturer](companytype)
- I choose a [big](companysize) [manufacturing](companytype) company
- I choose a [huge](companysize) [manufacturing](companytype) company.
- I choose [huge](companysize) [manufacturing](companytype)

## intent:small_service
- I choose a [small](companysize) [service](companytype) company.
- I choose a [small](companysize) [service](companytype)
- I choose a [small](companysize)[service](companytype)type company
- I choose a [tiny](companysize) [service](companytype) company.
- [small](companysize)[service](companytype)
- I choose a [tiny](companysize) [servicing](companytype) company
- I choose a [mini](companysize) [service](companytype) company
- I choose [mini](companysize) [service](companytype)
- I choose [mini](companysize) [service type](companytype)
sara-tagger commented 4 years ago

Thanks for the issue, @amn41 will get back to you about it soon!

You may find help in the docs and the forum, too 🤗
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically closed due to inactivity. Please create a new issue if you need more help.