Analytics as a service - query databases using natural language
-
Clone the repository
-
ideally create a fresh virtual environment
-
install the requirements using
pip install -r requirements.txt -
create an openai.yaml file in the required_files folder and add your openai api key to it
-
follow the strucutre shown in example_openai.yaml and add your DB/schema/tables to this .yaml file too (dont ask why they are currently in the same .yaml file...)
-
run Back_end\code\generate_hierarchy.py
you now the bare minimum to start using the bot, depending on the number of tables, complexity of tables, or naming conventions you may need to be quite specific with your prompts, but the bot should be able to handle most cases.
(optional setup - very early development stage, may not work as expected)
-
if you have any relevent SQL code that makes use of any relevent tables, throw them into this folder: Back_end\vector_data\sql_snippets. you can then run the dynamic_info_create.py file to create extract relevent information from the sql code.
-
Then, you can use he create_improved_hierarchy.py file to udate the hierarchy file. This will make the bot more accurate, and will also allow it to handle more complex queries. Alternitavly, you can add details to the hierarchy file manually, if you have sufficent background knowledge of the specific of the tables this can be helpful.
-
start the streamlit app by running run_app.py
-
type things in the text box