Skip to content

jarvislin94/NaturalSQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NaturalSQL

A demo to using natural language to query SQLite DB

About

This repository contains code that combines SQLite querying with OpenAI's GPT-3.5-turbo language model. The code allows users to interact with a SQLite database using natural language queries through a chat-like interface.

Features

  • Connects to a SQLite database (chinook.db) using the sqlite3 library.
  • Utilizes OpenAI's GPT-3.5-turbo language model for natural language processing.
  • Supports querying the database by generating SQL queries based on natural language.
  • Retrieves table and column information from the database to assist with query generation.
  • Allows users to ask questions about the music database and receive SQL query responses.

Installation

  1. Clone this repository to your local machine:

    git clone git@github.com:JackZong/NaturalSQL.git
  2. Install the necessary dependencies:

    yarn install
  3. Configure the API key and base path by editing the config.json file:

    {
      "apiKey": "<your_open_ai_api_key>",
      "basePath": "<base_path>",
      // if you are using rapid open ai APIs, this demo based on Rapid API's open ai APIs
      "rapidApiKey": "<your_rapid_api_key>",
      "rapidHost": "<rapid_host>"
    }

Usage

  1. Ensure that the SQLite database (chinook.db) is located in the ./db directory.

  2. Start the application:

    yarn start
  3. The application will connect to the database and retrieve the table and column information.

  4. The application will use OpenAI's GPT-3.5-turbo language model to generate an SQL query based on the hard-code natural language.

  5. The SQL query will be executed against the SQLite database, and the results will be displayed in the console.

Example

example

TODO

  • Supports to send message based on user inputs.

License

This project is licensed under the MIT License.

Acknowledgments

About

A demo to use natural language to query SQLite DB

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy