Giter VIP home page Giter VIP logo

chatgpt-sql's Introduction

ChatGPT SQL

Demo

Connecting ChatGPT to an SQL Server so that you can ask questions about data in natural language, and you also get an answer in natural language. It works by creating a layer between the user and ChatGPT that routes messages between the user and ChatGPT on one side, and ChatGPT and the SQL server on the other. ChatGPT is indicating whether the message it meant for the user or for the server. What you see in the below image is the following:

  1. The user asks a question ("What is the top selling product by revenue in 2013?")
  2. The script forwards the question to ChatGPT.
  3. ChatGPT responds with a request for schema information.
  4. The script queries the database schema in SQL server and sends the result back to ChatGPT.
  5. ChatGPT Formulates an SQL query based on the schema information
  6. The script executes the query against the database and sends the result back to ChatGPT.
  7. ChatGPT interprets the result and formulates an answer (indicating it should be shared with the user)
  8. The script shares the answer with the user. ("The top selling product by revenue in 2013 is the Mountain-200 Black, 38.").

The app is currently configured to work with the AdventureWorks database, but it should be possible to make it work with any other database as well.

Some caveats:

  • The database I use is the AdventureWorks database, which ChatGPT also knows from it's training data, which means it's probably performing better than it would with other databases.
  • It sometimes breaks, due to ChatGPT not following protocol.

Still, I think it's a pretty cool POC ๐Ÿ™‚

chatgpt-sql's People

Contributors

kulltc avatar mtricht 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.