Giter Club home page Giter Club logo

5106-nl2sql's Introduction

NL2SQL_CS6101

Implement MAC-SQL as a backend service.

Some changes:

  • Change database schema representation to code representation
  • Change foreign keys representation to dictionary representation
  • Use DIN-SQL self-correction in the refiner

Setup

Set up environment

conda create -n nl2sql_cs6101 python=3.10
conda activate nl2sql_cs6101
pip install -r requirements.txt

Set LLM

  • If use OpenAI LLMs, change the API_KEY in app/core/llm.py to your own key
  • If use self-deployed LLMs, add/change corrsponding code in app/core/llm.py

Set Database

Run

cd app
python app.py

The service will start at port 18080

Request format

  • Request url: localhost:18080/predict
  • Request body Content-Type: application/json
{
    "natural_language_query": "Show name, country, age for all singers ordered by age from the oldest to the youngest."
}

Response format

{
    "success": False,
    "message": "Content-Type must be application/json"
}

or

{
    "success": true,
    "sql_queries": [
        "SELECT \"Name\", \"Country\", \"Age\"     FROM singer     ORDER BY \"Age\" DESC"
    ]
}

5106-nl2sql's People

Contributors

hou-sz avatar

Watchers

Li Zelin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.