How to make rasabot able to fetch answers in mysql database

hi, I’m from Indonesia, I’m a vocational high school student, I’m still studying with Rasa, and I have the task of making a bot whose answers are taken from the database that has been provided. It’s just how can Rasabot retrieve answers in the mysql database, where there are many in the database? table and in the table there are many answers where each answer is used for a different question, for example there are 5 answers in one table namely apples, bananas, oranges, grapes and strawberries and I want to take one of these answers for one question as an example if the user asks about apples, the bot will answer apples or if the user asks about bananas, the bot will answer bananas and so on. and how to solve this problem, is there a solution to this problem or is there a script that can solve the problem. I beg for your help

It sounds like a Rasa NLG server might be a solution here. There is an example NLG server available at rasa/nlg_server.py at main · RasaHQ/rasa · GitHub.

1 Like

thanks you very much for the reference, i hope this gonna help me for my task

Hello Aiyub150 has your issue been solved

1 Like

@Aiyub150 , you can use custom actions to call your mysql database. Refer to this post on how to connect to database -Fetching data from an oracle database

Sorry, is not solved and i don’t know how to use nlg server so i try to use custom action

Thanks you very much for the reference :smiley:

First you need to create a connector in your actions.py file: You could use pymsql to do that.