This project is an AI-powered SQL chatbot that allows users to interact with SQLite or MySQL databases using natural language queries.
The application uses:
- LangChain SQL Agent
- Groq LLM
- Streamlit interface
Users can ask questions in plain English, and the chatbot automatically generates and executes SQL queries to retrieve results from the database.
✅ Chat with SQLite database using natural language
✅ MySQL database support
✅ Streamlit-based interactive UI
✅ LangChain SQL Agent integration
✅ Groq LLM support
✅ Real-time response streaming
✅ Intermediate agent reasoning display
| Technology | Purpose |
|---|---|
| Python | Core programming language |
| Streamlit | Frontend web application |
| LangChain | AI agent framework |
| Groq API | LLM inference |
| SQLite | Local database |
| MySQL | External database support |
| SQLAlchemy | Database connectivity |
langchain-database-chatbot-main
│
├── app.py
├── sqlite.py
├── requirements.txt
├── README.md
└── .gitignore
STUDENT(
NAME VARCHAR(25),
CLASS VARCHAR(25),
SECTION VARCHAR(25),
MARKS INT
)Sample records are inserted using sqlite.py.
git clone https://github.com/RudraChouhan03/langchain-database-chatbot.git
cd langchain-database-chatbotpython -m venv myvenvmyvenv\Scripts\activatesource myvenv/bin/activatepip install -r requirements.txtpython sqlite.pyThis creates student.db with sample records.
streamlit run app.pyGet your API key from:
👉 https://console.groq.com/keys
Paste the API key into the sidebar input field after starting the application.
- Show all students
- Who scored the highest marks?
- Show students from Data Science class
- List all students from section A
- What is the average marks of students?
User Query
↓
LangChain SQL Agent
↓
LLM generates SQL query
↓
Database execution
↓
Results returned to user
- Chat memory support
- CSV upload support
- Query result visualization
- Download query results
- Multi-database connection support
- Authentication system
Computer Science Engineering Student
Interested in Data Science, Generative AI, and Agentic AI
This project is licensed under the MIT License.