Code Monkey home page Code Monkey logo

raycast-querygpt's Introduction


Raycast QueryGPT

A raycast extension to query a Postgre SQL database using GPT generated SQL queries and visualize results using Chart.js

Inspired by censusgpt.com and Metabase questions

A little demo with data form ProductHunt's API

demo

Like this project ?

  • 🐥 Follow me on Twitter: @m_dolr
  • ⭐️ Star this repository on GitHub

⚠️ Disclaimer

The code contains direct evaluation from GPT responses. This project is provided without any warranty. It is not intended to be used in production. Run at your own risks.

Requirements

  • An OpenAI GPT API Key
  • A Postgres SQL Database
  • Raycast v1.48.8+

Development

  1. git clone raycast-queryGPT
  2. cd raycast-queryGPT
  3. yarn
  4. yarn dev

Approach

The question is passed to GPT along with a description of the database schema, GPT is asked to return a SQL Query.

The SQL Query is then executed against the database

The query and a sample table of the results are passed to GPT in order to ask for what would be the most appropriate visualization for the results between "sentence", "chart" and "table"

Depending on the chosen type the results are then displayed in the appropriate format either using a sentence generated by GPT or by using a JS Object dynamically generated and passed to Chart.js

Use with your DB

Update the initial prompt in api.ts:101 to match your DB schema

Improvements

  • Have some kind of setup where there is an initialization phase synchronizing the schema and asking the user to describe the schema dynamically during the setup phase and on migrations

License

This project is licensed under the MIT license. See the LICENSE file for more info.

raycast-querygpt's People

Contributors

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