Skip to content

xJoeyCodes/ai-sql-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI SQL Agent

This repository contains a small SQL agent that uses IBM Watsonx (WatsonX) and LangChain to run SQL queries against a MySQL database.

Security first: Do NOT commit secrets or credentials. Fill in a local .env file (copy from .env.example) and add it to .gitignore.

Quick start

  1. Create and activate a virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Copy .env.example to .env and update values with your own credentials
cp .env.example .env
# Edit .env and fill in WATSONX_URL, WATSONX_APIKEY, and database settings
  1. Run the agent
python sqlagent.py --prompt "SELECT * FROM Album LIMIT 5;"
# Or override DB URI directly:
python sqlagent.py --db-uri "mysql+mysqlconnector://user:pass@host:3306/Chinook" --prompt "SELECT * FROM Album LIMIT 5;"

About

AI-powered SQL agent built with LangChain and IBM Watsonx that translates natural language questions into SQL queries and retrieves database insights.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages