Skip to content

JaredBaileyDuke/sql-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Chatbot Agent for Civil Engineering Data

This project provides a SQL chatbot agent designed to query and analyze civil engineering data. The agent leverages OpenAI, LangChain, and additional tools (like Google Search) to answer queries related to civil engineering construction projects.

Due to the sensitive data in question, this project has public facing and private data. For the public facing side of this project, I am showcasing a sample music database that can be queried. The chatbot converts natural language to SQL, and returns to the user the expected answer and the thinking + code that was used to arrive there.

Music Examples

This project is still evolving for the client in question.

Sample Data

As mentioned above, the data for this project is secret and I've provided a sample database to pull from.

Queries such as the following show the power of this chatbot:

  • How many customers purchased AC/DC albums?
  • Which employee (first and last name) sold the most albums, and how many were sold?

Data Sources

SQLite Sample Database


Setup

1. Create a Python Virtual Environment

Windows

py -m venv venv

Mac/Linux

python3 -m venv venv

2. Activate the Virtual Environment

Windows

source venv/Scripts/activate

Mac/Linux

source venv/bin/activate

3. Install Required Packages

Run the requirements.txt file

pip install -r requirements.txt

4. Set Environment Variables

Create a .env file in your project root directory and add the following variables (replace placeholder values with your actual keys):

OPENAI_API_KEY=your_openai_api_key_here
SERPAPI_API_KEY=your_serpapi_api_key_here
  • OPENAI_API_KEY: Your OpenAI API key.
  • SERPAPI_API_KEY: API key for SerpAPI (if using for internet searches).

Running the Application

Start the virtual environment (if not already started):

Windows

source venv/Scripts/activate

Mac/Linux

source venv/bin/activate

Start the app

After configuration, you can run the application using Streamlit:

streamlit run app.py

About

SQL agent for civil engineering data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages