Repository

langchain-text-to-sql

Build a TEXT-TO-SQL query system using LangChain

README

Text to SQL with LangChain

This project demonstrates how to build an interactive SQL query system using LangChain, GPT-4, and a SQLite database. Users can ask natural language questions, which the system translates into SQL queries, executes against a SQLite database, and then provides detailed answers based on the query results.

Features

  • Natural Language to SQL: Converts user questions into SQL queries using GPT-4.
  • Database Integration: Connects to a SQLite database (Chinook).
  • Interactive CLI: Provides an interactive command line interface for real-time questioning.
  • Customizable Prompts: Option to customize the system prompt for query generation.

Requirements

Installation

git clone https://github.com/samugit83/langchain-text-to-sql
cd langchain-text-to-sql
docker-compose build
docker-compose up -d

Run the script

docker-compose exec sql_query_system bash
python main.py