BenderV / olympe

Query your database in plain english

Home Page:https://www.olym.pe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Olympe

A natural language interface to query databases

Try it here πŸ‘‰ olym.pe

If you are interested in this project, or just want to discuss, contact me on twitter

🚧 It's a proof-of-concept, there is lots of work to be done here... 🚧

Features

  • Support high number of tables
  • Syntax support for entities ("Netflix" will match "net-flix")
  • Use of database values and types to improve the query generation

Nice to have

  • Multiple databases support
    • Postgres
    • BigQuery (wip)
  • Plot results in a table or in a chart depending on the query/results
  • Possibility to edit & correct the sql query
  • Upload of CSV
  • Support multiple profils and organisations

Preview

image

Tech stack

  • AI based on OpenAI's GPT-3 API
  • Frontend: Vue3, Vite
  • Backend: NestJS
  • Database: Postgres
  • Upload Service: sanic (python)

Code structure

β”œβ”€β”€ service: backend in nestjs
β”‚   β”œβ”€β”€ src/databases
β”‚   β”‚   β”œβ”€β”€ implementatons (postgres, bigquery)
β”‚   β”œβ”€β”€ src/files
β”‚   β”œβ”€β”€ src/queries
β”‚   β”œβ”€β”€ src/tables
β”‚   β”œβ”€β”€ src/users
β”œβ”€β”€ uploader: micro service to upload data to the playground
β”œβ”€β”€ view: frontend in vue3

Setup

Back-end

in /service

  • create a .env file with the following content:
OPENAI_API_KEY=sk-...
DATABASE_URL=postgres://...
  • yarn -- install dependencies
  • yarn typeorm migration:run -- run migrations
  • yarn start:dev -- run the backend

Front-end

in /view

  • yarn -- install dependencies
  • yarn dev -- run the front

Database

You will need to add a database to start using the service

Upload service

Check README.md in /uploader for more details

Auth (optional)

You can add users management with Propelauth by adding the following env variables:

/service/.env

PROPELAUTH_URL=
PROPELAUTH_APIKEY=
PROPELAUTH_VERIFIER_KEY=
PROPELAUTH_ISSUER=

/view/.env

VITE_PROPELAUTH_URL=

Docker compose (alternative)

If you prefer to use docker-compose, you can use the following command:

docker-compose up --build

You can modify the docker-compose.yml file to add variables or modify the database url.

NL2SQL pipeline

  1. getDatabaseSchema
  2. selectTables (openai.select_tables.ejs)
  3. extractConditionsValues (openai.where.ejs)
  4. fetchClosedValues (from database)
  5. getValidatedQueriesExamplesOnDatabase (openai.default.ejs)

About

Query your database in plain english

https://www.olym.pe


Languages

Language:TypeScript 62.9%Language:Vue 29.3%Language:Python 3.3%Language:JavaScript 2.0%Language:EJS 1.4%Language:HTML 0.6%Language:Dockerfile 0.4%Language:CSS 0.0%Language:Shell 0.0%