Skip to content

NL2SQL-Pro translates natural language to SQL using a local Llama 3 model via Ollama. It offers a private, secure, and cost-effective way to generate accurate SQL, keeping all your data on your machine.

Notifications You must be signed in to change notification settings

NEVIL5249/NL2SQL-Pro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NL2SQL-Pro

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.

🚀 Features

  • 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.

🛠️ Technologies Used

Frontend (Client)

  • React.js: For building the interactive user interface.
  • HTML/CSS/JavaScript: Standard web technologies.

Backend (Server)

  • 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.

📦 Installation

To get this project up and running on your local machine, follow these steps:

  1. Clone the repository:

    git clone [https://github.com/NEVIL5249/NL2SQL-Pro.git](https://github.com/NEVIL5249/NL2SQL-Pro.git)
    cd NL2SQL-Pro
  2. 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).
  3. Install client dependencies: Navigate into the client directory and install its dependencies.

    cd client
    npm install
    cd .. # Go back to the root directory
  4. Install server dependencies: Navigate into the server directory and install its dependencies.

    cd server
    npm install
    cd .. # Go back to the root directory
  5. Start the server: From the server directory, start the backend server.

    cd server
    node index.js

    The server will typically run on http://localhost:5000.

  6. Start the client: Open a new terminal window, navigate to the client directory, and start the React development server.

    cd client
    npm start

    The client will typically open in your browser at http://localhost:3000.

📁 Project Structure

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

🧪 Demo

🖥️ User Interface

This is how the clean and modern UI looks.

Screenshot of the UI

🎬 Live Conversion

Watch a quick video of the application in action.

Watch the Demo Video

About

NL2SQL-Pro translates natural language to SQL using a local Llama 3 model via Ollama. It offers a private, secure, and cost-effective way to generate accurate SQL, keeping all your data on your machine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors