@bparikh99 Here it is
from typing import Any, Text, Dict, List
from rasa_core_sdk import Action
from rasa_core_sdk import Tracker
from rasa_core_sdk.events import SlotSet
from rasa_sdk.executor import CollectingDispatcher
class MedicalNecessity(Action):
def name(self) -> Text:
return "action_necessity"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
incident_no = tracker.get_slot('incident_no')
# from database medical necessity reason is fetched and stored in 'reason' variable
reason = 'xyz'
bot_response = " For {} incident number the medical necessity reason is {}".format(incident_no, reason)
dispatcher.utter_message(text=bot_response)
return [SlotSet('incident_no', incident_no)]
class ServiceLevel(Action):
def name(self) -> Text:
return "action_service"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
incident_no = tracker.get_slot('incident_no')
# from database service level is fetched and stored in 'level' variable
level = 123
bot_response = " For {} incident number the level of service is {}".format(incident_no, level)
dispatcher.utter_message(text=bot_response)
return [SlotSet('incident_no', incident_no)]
class NecessityAndService(Action):
def name(self) -> Text:
return "action_necessity_service"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
incident_no = tracker.get_slot('incident_no')
# from database medical necessity reason is fetched and stored in 'reason' variable
# service level is fetched and stored in 'level' variable
reason = 'abc'
level = 123
bot_response = " For {} incident number the medical necessity reason is {} and level of service is {}".format(
incident_no, reason, level)
dispatcher.utter_message(text=bot_response)
return [SlotSet('incident_no', incident_no)]