A powerful full-stack web application that translates natural language queries into optimized SQL statements using the locally run Llama 3 Large Language Model via Ollama. It's designed for privacy-focused data interaction, allowing users to query databases without sending sensitive information to external APIs.
- Natural Language to SQL Conversion: Transform plain English questions into accurate SQL queries.
- Local LLM Integration: Utilizes Ollama to run Llama 3 locally, ensuring data privacy and reducing API costs.
- Schema Context Awareness: Accepts database schema input for more precise and contextually relevant SQL generation.
- Multiple SQL Dialects: Supports PostgreSQL, MySQL, SQLite, and SQL Server.
- Clean & Modern UI: A minimalist and intuitive user interface built with React.
- Real-time Feedback: Provides instant toast notifications for actions and errors.
- React.js: For building the interactive user interface.
- HTML/CSS/JavaScript: Standard web technologies.
- Node.js: JavaScript runtime for the server.
- Express.js: Web framework for building the API.
- Ollama: Framework for running large language models locally.
- Llama 3: The powerful LLM used for natural language processing and SQL generation.
To get this project up and running on your local machine, follow these steps:
-
Clone the repository:
git clone [https://github.com/NEVIL5249/NL2SQL-Pro.git](https://github.com/NEVIL5249/NL2SQL-Pro.git) cd NL2SQL-Pro -
Install Ollama and pull Llama 3:
- Download and install Ollama from ollama.com.
- Once installed, open your terminal and pull the Llama 3 model:
ollama pull llama3
- Ensure the Ollama server is running (it usually starts automatically after installation).
-
Install client dependencies: Navigate into the
clientdirectory and install its dependencies.cd client npm install cd .. # Go back to the root directory
-
Install server dependencies: Navigate into the
serverdirectory and install its dependencies.cd server npm install cd .. # Go back to the root directory
-
Start the server: From the
serverdirectory, start the backend server.cd server node index.jsThe server will typically run on
http://localhost:5000. -
Start the client: Open a new terminal window, navigate to the
clientdirectory, and start the React development server.cd client npm startThe client will typically open in your browser at
http://localhost:3000.
NL2SQL-PRO/
├── .gitignore # Specifies files and directories to be ignored by Git
├── client/ # The React frontend application
│ ├── public/ # Static assets for the React app
│ ├── src/ # The source code for the React app
│ │ ├── App.css
│ │ ├── App.js # Main React component
│ │ ├── index.css
│ │ └── index.js # Entry point for the React app
│ │ └── ...
│ ├── package.json # Dependencies and scripts for the React app
│ └── package-lock.json # Lock file for client dependencies
│
└── server/ # The Node.js backend
├── index.js # The main server file (Express application)
├── package.json # Dependencies and scripts for the server
└── package-lock.json # Lock file for server dependencies
This is how the clean and modern UI looks.
Watch a quick video of the application in action.
