Skip to content

RobertFrenette/CSCI_E-89_Deep_Learning_Fall_25

Repository files navigation

πŸŽ“ CSCI_E-89_Deep_Learning_Fall_25

Repo for the CSCI E-89 Deep Learning Final Project (Fall '25, Harvard Extension School)


Updates

2025-12-29: The feature/refactor-ai-agent-insure-platform branch contains an updated version of the AI Agent Insure Application Platform.

Shield Icon AI Agent Insure Application Platform

The AI Agent Insure Application Platform is a production-ready insurance management system that combines:

  • Structured Data (PostgreSQL): Policies, claims, customers, risk profiles
  • Document Knowledge Base (ChromaDB): Company information, products, procedures
  • User Data (MongoDB): User profiles and query history
  • AI Agent: Intelligent query routing and RAG-powered question answering

Key Features

πŸ€– Intelligent Query Routing - Automatically routes queries to SQL, RAG, or Hybrid processing
πŸ’¬ Multimodal Chat Interface - Text and speech input/output for both admin and client users
πŸ“Š Admin Dashboard - Professional Next.js dashboard for support personnel
πŸ‘€ Client Portal - Modern customer-facing portal with policy management
πŸ“„ PDF Document Upload - Upload and ingest PDFs into the knowledge base
πŸ”„ CSV Data Refresh - Refresh database from CSV files via API
⚑ Performance Optimized - Query caching, connection pooling, and optimized database queries
πŸ”’ Role-Based Access Control - Admin, authenticated client, and guest user permissions

See the feature/refactor-ai-agent-insure-platform branch for detailed documentation and setup instructions.


πŸ“š Course Information

πŸ€– Project Information

  • Project: Local Assistant (LLM & RAG)
  • Description: A local assistant leveraging large language models (LLMs) and retrieval-augmented generation (RAG) techniques to provide contextual assistance and information retrieval.

🎬 Video Links

πŸ› οΈ Technologies Used

  • Ollama: Local LLM hosting server
  • llama3.2:3b: LLM
  • nomic-embed-text: Embedding Model
  • LangChain: Framework for developing applications powered by language models
  • Chroma: Vector database for storing and retrieving embeddings
  • Gradio: Framework for building machine learning and data science web apps

πŸ“– Resources

πŸš€ Quick Start / Setup

Prerequisites

  1. Python 3.12+ installed
  2. uv package manager installed (install instructions)
  3. Ollama running locally:
    ollama serve
  4. Required Ollama models (will be pulled automatically if not present):
    • llama3.2:3b (for LLM inference)
    • nomic-embed-text (for embeddings)
  5. ffmpeg: brew install ffmpeg (macOS)

Initialization

The project includes an initialization script (init.sh) that sets up the entire environment and prepares all data.

Configuration: The application supports configuration via environment variables using a .env file. Before running the application, rename sample.env.txt in the project root to .env. See the .env file for customizable settings. All configuration values can be overridden without modifying code.

Option 1: Execute Script (venv activated during execution only)

./init.sh
# After completion, activate venv manually:
source .venv/bin/activate

Option 2: Source Script (venv remains active after completion)

source init.sh
# Venv is already activated after completion

The script will:

  1. Clean up existing .venv, __pycache__, logs, and databases
  2. Create virtual environment (uv venv --python python3.12)
  3. Install dependencies (uv pip install -r requirements.txt)
  4. Create SQLite database (insured-db/insureds.db)
  5. Create vector store (vector-store/chroma_db/)

Running the Application

After initialization:

# Activate venv (if not already activated)
source .venv/bin/activate

# Run the application
cd agent
python app.py

The application will be available at http://127.0.0.1:7861

For detailed setup instructions and configuration options, see agent/README.md.

πŸ“‚ Project Structure

The main application directory containing the hybrid RAG chatbot. See agent/README.md for detailed documentation.

  • Main Application: app.py - Entry point for the chatbot
  • UI: ui.py - Gradio interface separated from app logic
  • Configuration: config.py - All settings (supports .env file)
  • Processors: Domain processors for RAG, SQL, and audio processing
  • Routing: Intelligent query routing (SQL vs RAG detection)
  • Logging: Centralized logging configuration

Source PDF documents used for RAG retrieval. Documents are organized by category:

  • company/: Company overview and website information
  • products/: Product brochures and coverage details
  • guides/: Process guides (claims, underwriting, coverage boundaries)
  • agent_support/: Agent support guides for various products
  • personnel/: Organizational information

These PDFs are processed into embeddings stored in vector-store/chroma_db/.


Vector database containing embeddings of all PDF documents. See vector-store/README.md for details.

  • Creation Script: create_chroma_vectorstore.py - Generates embeddings from PDFs
  • Database: chroma_db/ - Persistent ChromaDB storage (created by script)

SQLite database containing structured insurance data. See insured-db/README.md for schema details.

  • Creation Script: create_and_seed_insureds_db.py - Creates database from CSV files
  • Database: insureds.db - SQLite database with 100 insureds, 208 policies, 46 claims
  • Source Data: insured_data/ - CSV files used to seed the database

Evaluation framework for testing RAG and SQL query systems. See agent-eval/README.md for usage.

  • Test Script: test.py - Runs evaluation tests
  • Evaluation Logic: eval.py - Core evaluation functions
  • Test Data: test_data.json - Test cases (6 RAG + 4 SQL = 10 total)
  • Results: results/ - JSON test results with timestamps
  • Analysis: analysis.ipynb - Jupyter notebook for visualizing results

πŸ“„ PDF Documents (for RAG)

  • PDF documents for this project contain fictitious data (created using an LLM) and are solely for demonstrative purposes.

πŸ—οΈ High-Level Architecture Diagram

Architecture Diagram

πŸ“Έ Screenshots

πŸ’¬ Text Query

Text Query

🎀 Audio Query

Audio Query


Credit: This markdown file was generated by πŸ€– GitHub Copilot.

About

Repo for the CSCI E-89 Deep Learning Final Project (Fall '25, Harvard Extension School)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •