sql-ai-query-generator
v1.0.4
Published
This is a node package which can be used to generate SQL queries by providing inputs in simple English.
Downloads
15
Maintainers
Readme
sql-ai-query-generator
This is a node package that you can use to generate SQL queries by providing inputs in simple English.
It uses OpenAI to generate SQL queries.
Installation
npm install sql-ai-query-generator
You can import in the ES Module via:
import createSQLQuery from 'sql-ai-query-generator';
You can import in CommonJS Module via:
const { createSQLQuery } = require("sql-ai-query-generator");
Usage
const { createSQLQuery } = require("sql-ai-query-generator");
const main = async () => {
const query = await createSQLQuery(API_KEY, ENGINE, QUERY);
};
main();
CreateSQLQuery Function Arguments
API_KEY
:string
, required:true
ENGINE
:string
, required:true
, options:gpt-3.5-turbo, gpt-4
QUERY
:string
, required:true
Additional Resources
How to generate OpenAI API Key
: OpenAI API Guide
Example
You can interact with the example in a few different ways:
- Check the live Demo.Click here.
- Hit the live API using this package with Postman. Use the below details.
Method
:POST
Endpoint
:https://sql-query-generator-backend.onrender.com/query
Body
:{"QUERY": "Create user table with firstname, lastname, DOB, highest education"}