I am trying to implement RASA Chatbot on Colab and finding hard to customize Actions.. Rest all works fine, except the actions.. I feel that my chatbox is not entering my actions.. Can anyone please guide me.. nlu_md = """ ## intent:greet - Hello - hello - good morning ## intent:justbook - table for 1 - make reservations for me - make reservations for 1 person """ %store nlu_md > nlu.md stories_md = """ ## Story 1 * greet - action_print """ %store stories_md > stories.md domain_yml = """ %YAML 1.1 --- actions: - utter_booking_confirmation - utter_greeting - utter_thankyou - __main__.Printer - action_print entities: - time - date - number_of_people intents: - time - when - book - greet - justbook templates: utter_greeting: - text: Welcome to the restaurant ! How can I help you ? utter_thankyou: - text: Thank You for using our services ! See you again soon ! utter_confirm: - text: Your booking is confirmed for {number_of_people} on {date} at {time}. Thank You. See you soon """ %store domain_yml > domain.yml
Actions
from rasa_core_sdk import Tracker from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet from rasa_core_sdk.executor import CollectingDispatcher from rasa_core.actions import Action class Printer(Action): def name(self): return "action_print" def run(self, dispatcher, tracker, domain): no_of_people=tracker.slots['number_of_people'] time=tracker.slots['time'] date=tracker.slots['date'] print('ENTERED PRINTER') dispatcher.utter_message('hi i am in Printer') #return ''
Chatbox!
from rasa_core.agent import Agent from rasa_core.utils import EndpointConfig from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.utils import EndpointConfig agent = Agent.load('models/dialogue',interpreter=RasaNLUInterpreter('/content/drive/My Drive/restaurant bot/models/nlu/default/restaurantbot'), action_endpoint=EndpointConfig(url="http://127.0.0.1:5055/webhook")) print("Bot is ready to talk! Start conversation with 'hi'") while True: st = input() if st == 'stop': break responses = agent.handle_text(st) for response in responses: print(response["text"])
Expected Output
I am expecting output : Entered Printer HI I am in Printer.
Output I get I dont get the expected output, I just get the text box for input…