drorm / ria

Use GPT3.5 to convert English requests into SQL queries and get the result of the query
MIT License
9 stars 1 forks source link

Ria GPT natural language interface to Postgres

Ria, Relational Information Assistant, is a CLI that allows you to easily query a database using natural language. Simply enter your request in English , and RIA will translate your request into a SQL query, run the query, and return the results to you.

This is just a proof of concept to demontrate the concept. 

Installation

Running

./run.sh

Features

Requirements

How to Use

  1. The basic command is fetch as in:
  1. Press the "Submit" button to run your query
  2. View the results of your query in the designated output area

Examples

Here are a few examples of requests you can make to RIA with the Pagila database:

How it works

The core of RIA is the shortSchema function. It creates an abreviated version of the db schema that GPT understands, while consuming less tokens. The rest, is just a standard prompt to ask GPT to convert the request to SQL.