Skip to content

This project leverages a pre-trained language model to convert natural language queries into SQL statements.

Notifications You must be signed in to change notification settings

Fredericcelerse/LLM-SQL-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Natural Language to SQL Converter

This project converts natural language queries into SQL queries using a pre-trained language model and executes them on a DuckDB database.

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/yourproject.git
    cd yourproject
  2. Install the dependencies:

    pip install -r requirements.txt
  3. Replace the placeholder YOUR_HF_TOKEN in main.py with your Hugging Face API token.

Usage

Run the project with:

python main.py

You can input natural language queries such as:

  • "What is the total sales for each product?"
  • "Which region sold the most laptops?"

The model will generate an SQL query and execute it on the DuckDB database.

Example Queries

  1. "What is the total sales for each product?"
  2. "Which region sold the most laptops?"
  3. "What is the best-selling product in terms of quantity?"

Try it out

You can try the code in an interactive environment on Google Colab:

Run on Google Colab

License

This project is licensed under the MIT License.

About

This project leverages a pre-trained language model to convert natural language queries into SQL statements.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages