Hello, Im new to Rasa. For my first project I am simply extending the demo bot and I have programmed it to respond to a few intents.
My main issue right now is trying to configure this bot to execute a custom action. The scenario where this happens is when the human user tells the bot they want to “book a hotel room”. This should execute a custom action that will eventually involve the bot making an API call, but right now I’ve set it to just respond with “This is a test”…see my files below.
STORIES:
## say goodbye
goodbye
utter_goodbye
## search path1
greet
utter_greet
book_hotel
utter_searching
action_get_hotel_link
DOMAIN:
action_names:
utter_greet
utter_goodbye
utter_searching
action_get_hotel_link
actions:
utter_greet
utter_goodbye
utter_searching
actions.BookHotel
intents:
greet
goodbye
affirm
book hotel
templates:
utter_searching:
text: “Let me find that for you!”
utter_greet:
text: “Hey! How can I help you?”
utter_goodbye:
text: “Bye”
ACTIONS:
from future import absolute_import
from future import division
from future import unicode_literals
from rasa_core.actions.action import Action
class BookHotel (Action):
def name(self):
return ‘action_get_hotel_link’
def run(self, dispatcher, tracker, domain):
sp_data = "this is a test"
dispatcher.utter_message(sp_data)
return []
But for some reason, the bot is never able to relay the dispatcher message back to the user…
and I get this error in terminal:
“2019-06-12 10:57:30 ERROR rasa.core.processor - Encountered an exception while running action 'action_get_hotel_link '. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.”
Perhaps I messed up on my syntax somewhere…could someone point me in the right direction??
Julian, there is an image of my actions.py file on my second post. I will try that.
But I just tried, this. Ran the “rasa run actions” command and then executed “rasa x” command in another terminal.
Retrained my model. Got these errors/warnings in the second terminal where I executed “rasa x”:
2019-06-12 12:56:15 WARNING rasa.core.training.dsl - Found unknown intent ‘book_hotel’ on line 8. Please, make sure th
at all intents are listed in your domain yaml.
2019-06-12 12:56:15 WARNING rasa.core.domain - Failed to use action ‘action_get_hotel_link’ in history. Please make su
re all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning.
It should stop appearing after a while.
(env) PS C:\Users\UH80906\Desktop\testbot–1> cd C:\Users\UH80906\Desktop\testbot–1
virtualenv env
.\env\Scripts\activate
rasa run -vv -m C:\Users\UH80906\Desktop\testbot–1\models --endpoints endpoints.yml --credentials credentials.yml --enable-api
$params = {
“I want to book a hotel room!”
}
Invoke-WebRequest -Uri http://localhost:5005/model/parse -Method POST -Body $params
Using base prefix ‘c:\python\python36’
New python executable in C:\Users\UH80906\Desktop\testbot–1\env\Scripts\python.exe
Installing setuptools, pip, wheel…
done.
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
Available web server routes:
/conversations/<conversation_id>/messages POST add_message
/conversations/<conversation_id>/tracker/events POST append_event
/webhooks/rasa GET custom_webhook_RasaChatInput.health
/webhooks/rasa/webhook POST custom_webhook_RasaChatInput.receive
/webhooks/rest GET custom_webhook_RestInput.health
/webhooks/rest/webhook POST custom_webhook_RestInput.receive
/model/test/intents POST evaluate_intents
/model/test/stories POST evaluate_stories
/conversations/<conversation_id>/execute POST execute_action
/domain GET get_domain
/ GET hello
/model PUT load_model
/model/parse POST parse
/conversations/<conversation_id>/predict POST predict
/conversations/<conversation_id>/tracker/events PUT replace_events
/conversations/<conversation_id>/story GET retrieve_story
/conversations/<conversation_id>/tracker GET retrieve_tracker
/status GET status
/model/predict POST tracker_predict
/model/train POST train
/model DELETE unload_model
/version GET version
2019-06-13 09:52:25
INFO