Giter Site home page Giter Site logo

manojmanivannan / ask-db Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 249 KB

Ask DB is an AI assistant that can understand your DB schema & content and answer questions in natural language

Dockerfile 16.22% Makefile 9.53% Python 61.86% Batchfile 6.96% Shell 5.44%

ask-db's Introduction

Ask DB

Ask DB is an AI assistant that can understand your DB schema & content and answer questions in natural language. Currently it uses OPENAI's LLM using the concept of retrieval-augmented generation, meaning, it understand the data and schema from the db and uses appropriate SQL query to extract the information needed to answer your question.

Sample

With a simple schema, the model is able to join the appropriate table, to answer a question like below.

what were the top 5 most crimes that occurred in august 2023 and what were they and how many of them took place ?

SELECT "crime_code_description"."crime_description", COUNT(*) AS "num_crimes"
FROM "crime_data"
INNER JOIN "crime_code_description" ON "crime_data"."crime_code" = "crime_code_description"."crime_code"
WHERE "date_occured" BETWEEN '2023-08-01' AND '2023-08-31'
GROUP BY "crime_code_description"."crime_description"
ORDER BY "num_crimes" DESC
LIMIT 5;

SQLResult: [('VEHICLE - STOLEN', 3788), ('BATTERY - SIMPLE ASSAULT', 2875), ('BURGLARY', 2322), ('ASSAULT WITH DEADLY WEAPON, AGGRAVATED ASSAULT', 1990), ('VANDALISM - FELONY ($400 & OVER, ALL CHURCH VANDALISMS)', 1941)]

Answer: The top 5 most crimes that occurred in August 2023 were vehicle theft, battery, burglary, aggravated assault, and felony vandalism. There were 3788 vehicle thefts, 2875 battery incidents, 2322 burglaries, 1990 aggravated assaults, and 1941 felony vandalism cases.

Note: OPENAI's API is required for this to work

ask-db's People

Contributors

manojmanivannan avatar

Watchers

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