Hi,
I am new to rasa framework and have been trying to work around with simple bot to extract some information and send email by taking in relevant information for sending email
I am getting this error while filling slot in form. Please help me to identify the error
Relevant files are attached below:
config.yml (318 Bytes)
nlu.md (2.7 KB)
domain.yml (1.3 KB)
stories.md (1.0 KB)
actions.py
from typing import Dict, Text, Any, List, Union, Optional
from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.events import SlotSet from rasa_sdk.events import AllSlotsReset from rasa_sdk.forms import FormAction import smtplib, ssl from email.message import EmailMessage #import getpass
class ActionGetProfitValue(Action): def name(self) → Text: return “action_ask_profit”
def run(self, dispatcher, tracker, domain):
dept_profit = {"sales" : 130000,
"finance" : 80000,
"IT" : 95000,
"marketing" : 150000,
"logistics" : 50000}
dept = tracker.get_slot('department_name')
try:
if(dept==None or dept==''):
dispatcher.utter_message("Profit amount for all department is {}".format(sum(dept_profit.values())))
else:
dispatcher.utter_message("Profit amount for {} is {}".format(dept, dept_profit[dept]))
except:
dispatcher.utter_message("'{}' is not a valid entry".format(dept))
return [SlotSet("department_name", None)]
class EmailFormAction(FormAction): def name(self): return “email_form”
@staticmethod
def required_slots(tracker):
"""A list of required slots that the form has to fill"""
return ["email_recipient","email_subject","email_message"]
def submit(self, dispatcher, tracker, domain):
"""Define what the form has to do
after all required slots are filled"""
dispatcher.utter_message("all slots have been filled")
# utter submit template
dispatcher.utter_template("utter_email_sent", tracker)
return [AllSlotsReset()]