An LLM-driven SQL questions-answering tool for PostgreSQL database.
- Click
Generate Responsefor generating a response that contains SQL query - Click
Extract & Execute SQLfor extracting SQL query from response, executing query and displaying the results.
- Click
Generate Answerfor generating a answer to the question, given the result retrieved from the database.
Install the necessary dependencies for connecting with the PostgreSQL database and using the OpenAI Large Language Model:
pip install openai psycopg2-binary tiktokenThe application supports both locally hosted models and OpenAI models.
- Download ollama for hosting LLM locally: here
- Register your OpenAI API Key for using OpenAI model: here
- Put your API key in the
QA_sql/configs/config.conffile.
- Put your API key in the
Run the following Python script to open the interactive UI application:
python QA_sql/run.py --model_name MODEL_NAME --database_name DATABASE_NAMEReplace MODEL_NAME with your choice of LLM model and DATABASE_NAME with your database name.

