Skip to content

TitanBot is a LLM Agent that allows users to use natural language to query their transportation databases to analyze and visualize data.

Notifications You must be signed in to change notification settings

Conj43/TitanBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 

Repository files navigation

TitanBot

TitanBot is a Python chatbot that leverages the OpenAI API to query ChatGPT and interact with your transportation database. It allows users to ask natural language questions, query SQL databases, and receive insightful responses with interactive visuals. TitanBot can also dynamically generate and execute Python code, enabling real-time data analysis and customized outputs based on user queries.

Installation

Follow these steps to install and configure TitanBot locally:

Make sure you have:

Clone Repository

git clone https://github.com/Conj43/TitanBot.git
cd TitanBot/'TitanBot Code'

Create and Activate a Virtual Environment

Windows

python -m venv venv
venv\Scripts\activate

macOS/Linux

python -m venv venv
source venv/bin/activate

Install Dependencies

pip install -r requirements.txt

Configure OpenAI API Key

Windows

Command Prompt
set OPENAI_API_KEY=your-openai-api-key
PowerShell
$env:OPENAI_API_KEY="your-openai-api-key"

macOS/Linux

export OPENAI_API_KEY=your-openai-api-key

Deactivate and Reactivate your Virtual Environment

Windows

deactivate
venv\Scripts\activate

macOS/Linux

deactivate
source venv/bin/activate

Running the Application

streamlit run main.py

For Files Over 200MB (Example is for 400MB max but it can be increased)

streamlit run main.py --server.maxUploadSize 400

Usage

You'll need to upload a database in order to chat with TitanBot. You may use a SQLite database, one or multiple CSV files, or an API link to a database. Databases are opened in Read-Only mode, and CSV files and API links are queried by creating temporary SQLite databases, so no need to worry about data corruption.

  • Make sure Docker is running, you can check by running docker info in your terminal
  • Check to see if you have Python downloaded by running python --version or python3 --version
  • Double check your OPENAI API KEY is set correctly (run one of the following depending on your OS and it should print your api key)
  • echo %OPENAI_API_KEY% on Windows (Command Prompt)
  • $env:OPENAI_API_KEY on Windows (PowerShell)
  • echo $OPENAI_API_KEY on Linux/macOS

Demonstration

SQL Schema and Simple Query Execution

SQL_Schema_Demo.mp4

Speed Index for One Year Demo

One_Year_Speed_Index_Demo.mp4

Accident Map Demo

Accident_Map_Demo.mp4

Plot Displaying Average Speed by Hour of the Day

Average_TMC_Speed_Plot.mp4

Aggregated Travel Time Index Saved to CSV File

TTI_to_CSV_Demo.mp4

Contact

If you have any questions, suggestions, or feedback, please feel free to reach out to us via one of our emails. We would love to hear from you!

We welcome and encourage contributions from the community! If you have ideas on how to expand or improve this project, please fork the repository and submit a pull request. Let's make this project even better together.

About

TitanBot is a LLM Agent that allows users to use natural language to query their transportation databases to analyze and visualize data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages