A Discord bot made for assisting on the concepts of Datamodelling and Databases using OpenAI and Python.
You can add the bot to your server using this link.
NOTE: You need to have the required permissions (manage server
/administrator
) to be able to add the bot to your required server.
- BOT PREFIX :
;
you can use this to execute the bot commands (example -;help
)
To know the commands of the bot start by typing in ;help
- This will list out all the available commands this bot has till now.
If you would like to convert a natural text to its equivalent SQL query you can do so as
- typing
;texttosql
- which will prompt for a database and then a query - feed the database -
employee(person_name, street, city)
works(person_name, company_name, salary)
company(company_name, city)
manages(person_name, manager_name)
-
enter the natural language text query to convert to SQL query -
Find the names and the cities of residence of all employees who work for First Bank Corporation
-
The bot should generate an SQL query -
SELECT person_name, city
FROM employee, works, company
WHERE employee.person_name = works.person_name AND works.company_name = company.company_name AND company.company_name = 'First Bank Corporation'
Currently there are these commands available to execute on the server
;help
- List out the basic description of the bot and the available commands on it.;closure
- prompts for a relational Schema R and the functional Dependencies F, then returns the closure of all attributes (100% accuracy);texttosql
- prompts for a database and a query, then generates a SQL response query.;sqltotext
- prompts for a SQL query, then translates it into its natural language.;datalogtotext
- prompts for a datalog query, then translates it into its natural language.;trctotext
- prompts for a TRC query, then translates it into its natural language.;creator
- gives a little detail about me in case you want to contact 💁
The bot uses OpenAI API to generate the required queries from the given prompts, the bot has been coded using Python 3.9.9 which was then implemented as a discord bot.
NOTE: The answers generated the bot are done using OpenAI API GPT-3 Model engine and might not always generate correct response. However the answers generated are mostly precise and accurate to the actual answer (if they differ) and are constantly being improved. The tasks listed with (100% accuracy) are always accurate.
To communicate with discord, this bot uses the discord.py open-source library and its discord's API.
Currently this bot is being hosted on Heroku. To host it on your own machine, make sure you download the repository and install all the dependencies on requiremments.txt
. Change the enviroment variables in .env.example
accordingly and rename it as .env
You can run the bot using your terminal
python3 bot.py