dvwn/nl2sql-api
0
NL2SQL
A backend Command Line Interface (CLI) framework designed to evaluate and test various NL2SQL models.
Note: The frontend interface for this application is currently in progress and not yet available. All interactions are handled via the CLI.
Prerequisites & Installation
To run this CLI tool locally, follow these steps to set up your environment:
- Activate the Virtual Environment.
- Windows: venv\Scripts\Activate
- macOS/Linux: source venv/bin/activate
- Install Requirements
- Ensure a requirements.txt file exists in your project backend folder.
pip install -r requirements.txt
- Configure Environment Variable (.env)
Note: Users must generate your own free access token from your https://huggingface.co/settings/tokens to avoid rate limits.
- Create a .env file in the backend/ directory
- Add your Hugging Face Read Token to the file.
HFTOKEN=yourhuggingfacereadtokenhere
Usage Guide
Once your environment is set up and your token is configured, you can run the CLI application.
- Navigate to the Backend Directory
cd backend
- Launch the Application
python -m app.main
- Interacting with the CLI Menu Upon running the command, you will be presented with a main menu. Choose the number corresponding to your desired action:
- Running Question to SQL Test: Evaluates how well a model translates natural language queries into executable SQL commands.
- Running Question Answering Test: Evaluates the end-to-end process (Question -> SQL -> Database Execution -> Natural Language Answer).
- Exit/Quit: Closes the application.
- Model Selection & Batch Testing
- After selecting either option 1 or 2, the CLI will display a list of available NL2SQL models.
- Enter the number/name of the model you wish to test.
- Automatic Execution: Once a model is selected, the system will automatically begin running the batch test against the scenarios defined in scripts/test_cases.json. Sit back and wait for the reports to generate in your root folder!
🚧 Roadmap
- Development and integration of a graphical User Interface (Frontend).
- Additional database schema support.
