Skip to content

Chethan-Rao-04/LLM_Text2SQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Natural Language to SQL Query Converter

A Python application that converts natural language questions into SQL queries for querying host information from a PostgreSQL database. Uses Ollama's Mistral model and LangChain for query generation.

Prerequisites

  • Python 3.x
  • PostgreSQL database
  • Ollama running locally
  • Mistral model installed in Ollama

Installation

  1. Install required packages:
pip3 install -r requirements.txt

Configuration

Database Configuration

export DB_NAME= export DB_USER= export DB_PASSWORD= export DB_HOST=localhost export DB_PORT=5442

Running the Application

python3 src/main.py

Application functionality

  • Generate SQL queries from natural language
  • Execute the queries
  • Display formatted results
  • Example Questions
    • "Display the records which has os as Linux and return only upto 10 records"
    • "Display the records with more than 4 cores and return only upto 10 record"

Security

  • Export sensitive information as environment variables

Credentials-delete later

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages