Skip to content

NL2SQL-Converter transforms natural language sentences from any language into SQL queries, simplifying database interactions. It offers seamless and intuitive query generation for users of all SQL proficiency levels.

License

Notifications You must be signed in to change notification settings

samitugal/NL2SQL-Converter

Repository files navigation

NL2SQL-Converter

NL2SQL-Converter is a versatile tool that converts natural language sentences from any language into SQL queries, allowing users to query their databases effortlessly. Simply enter your question in your preferred language, and NL2SQL-Converter will generate the corresponding SQL query to fetch the data you need. This tool simplifies database interactions, making data retrieval accessible to everyone, regardless of SQL proficiency or language preference.

Currently, NL2SQL-Converter supports PostgreSQL as the database and utilizes Anthropic's Large Language Model for natural language processing. This combination ensures robust and accurate query generation for diverse and complex database interactions.

Features

  • Multi-Language Support: Convert natural language sentences from any language into SQL queries.
  • Effortless Query Generation: Simply enter your question in plain language, and get the corresponding SQL query.
  • PostgreSQL Integration: Seamlessly interact with PostgreSQL databases for data retrieval and management.
  • Powered by Anthropic: Utilizes Anthropic's advanced Large Language Model for precise natural language processing.
  • Robust Performance: Handles diverse and complex queries efficiently, ensuring reliable database operations.

Installation

To run the project, follow these steps:

  1. Clone the repository:
    git clone https://github.com/samitugal/NL2SQL-Converter.git
  2. Navigate to the project directory::
    cd NL2SQL-Converter
  3. Start the application and build the necessary components using Docker Compose::
    docker-compose up --build

Configuration

In the configs/DatabaseConfigs directory, you can choose from various database types and enter your database information according to your preferences. Ensure that the following environment variables are set in the .env file:

  • DATABASE_CONNECTION_PATH
  • LLM_CONFIG_PATH

Usage

The application runs on port 8000. To send a request, make a POST request to the /generate_response API endpoint. The request should include a parameter called request where users can write their desired query.

curl -X POST http://localhost:8000/generate_response -d '{"request": "Show me all records from the users table"}' -H "Content-Type: application/json"

Testing

A sample Northwind database is available within the PostgreSQL container. You can use this for testing your queries.

UI Development

The UI is still under development. If you would like to contribute, your support is welcome.

Example Requests and Responses

image

image

image

About

NL2SQL-Converter transforms natural language sentences from any language into SQL queries, simplifying database interactions. It offers seamless and intuitive query generation for users of all SQL proficiency levels.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published