I want to fetch data from two different databases in the same bot. How can I do this? Do I have to create multiple custom actions for that? if yes, what is the procedure? Or can I create a different class and use method overriding. Is there any other solution to this?
You can create both regular Python methods and Action classes in your
actions.py file. That being said, you can probably go for an approach like this:
# RASA Action Method class SomeAction(Action): def name(self) -> Text: return "action_A" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: . . if someCondition: value = get_from_database(db1) else: value = get_from_database(db2) . . # do something with value return # Regular Python method def get_from_database(database): if database == 'db1': # Fetch from database 1, extract and return the result elif database == 'db2': # Fetch from database 2, extract and return the result