Skip to content

Sakshithorat23/NL2SQL_Project

Repository files navigation

NL2SQL Clinic Assistant

An AI-powered agent that translates Natural Language into SQLite queries for hospital management.

Tech Stack

  • LLM: Google Gemini 2.0 Flash
  • Framework: Vanna.ai
  • Backend: FastAPI
  • Database: SQLite

Quick Start in 4 Steps

1. Environment Setup

Install the necessary libraries and create a .env file with your API key.

pip install vanna[sqlite,gemini] fastapi uvicorn python-dotenv pandas

2. Database Initialization

Run the script to create clinic.db and populate it with sample data (Patients, Doctors, Appointments).

python setup_database.py

3. Training & Benchmarking

Train the RAG model with "Golden SQL" pairs and generate the RESULTS.md accuracy report.

python seed_memory.py

4. Launch the API

Start the FastAPI server to handle live queries.

uvicorn main:app --port 8000

🧪 Testing the API

Once running, visit http://127.0.0.1:8000/docs to test the /chat endpoint.

Sample Question: "Show me the top 5 patients by total spending"

Evaluation

Benchmark results for 20 complex business questions are stored in RESULTS.md.

About

NL2SQL Clinic Assistant - An AI-powered agent that translates Natural Language into SQLite queries for hospital management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages