sandbreak80/rag_lab

0

stars

292

commits

Python

primary language

Nov 19, 2025

updated

README

πŸŽ“ Educational RAG Lab

An enterprise-grade RAG system for learning and experimentation - Built with modern AI architecture

License: MIT Python 3.11+ Docker Status Version

πŸ“˜ Read Current Status | View Changelog - Latest features and improvements


🌟 What is This?

The Educational RAG Lab is a production-ready reference architecture for LLM deployments, designed for hands-on learning and customer demonstrations. It features:

  • 14 Microservices - Complete production-grade RAG architecture
  • Modern React UI - TypeScript, Tailwind CSS, real-time streaming
  • Performance Waterfall Chart - Visualize RAG pipeline latency breakdown
  • Authentication System - JWT-based user auth with security controls
  • Citation Validation - Hallucination detection for accurate sourcing
  • Baseline Prompts - Pre-built queries for performance testing
  • Configuration Toggles - UI controls for all RAG features
  • Security Guardrails - PII detection, rate limiting, input sanitization
  • Research Agent - Autonomous AI paper discovery and ingestion
  • Comprehensive Documentation - Architecture, deployment, testing guides

Unique Value:

"This isn't just a RAG lab - it's a reference architecture for production LLM deployments, instrumented for Splunk from day one."

Perfect for:

  • 🎯 Splunk/Cisco Field Teams - Architects, SEs, Sales Leaders
  • πŸŽ“ Students - Learning RAG, LLMs, and production AI
  • πŸ‘¨β€πŸ« Instructors - Teaching enterprise AI deployment
  • πŸ”¬ Researchers - Experimenting with RAG configurations
  • πŸ‘¨β€πŸ’» Developers - Building production RAG systems

Launch on GPU-enabled EC2 with automated setup:

With vLLM Support (g5.2xlarge - NVIDIA A10G)

cd aws/scripts
./setup-github-secret.sh  # One-time security setup
./launch-g5-vllm.sh        # Launch with vLLM + Ollama
  • βœ… vLLM - 2x faster inference (Ampere GPU)
  • βœ… 24GB VRAM - Larger models (13B+)
  • βœ… Cost: ~$29/day running, ~$0.65/day stopped

Ollama Only (g4dn.2xlarge - NVIDIA T4)

cd aws/scripts
./setup-github-secret.sh   # One-time security setup
./aws-launch-rag-lab.sh    # Launch with Ollama
  • βœ… Ollama - Cost-effective development
  • βœ… 16GB VRAM - Small/medium models (7B)
  • βœ… Cost: ~$18/day running, ~$0.50/day stopped

Features:

  • βœ… Automated deployment (10-20 minutes)
  • βœ… Secure private repo access (AWS Secrets Manager)
  • βœ… No SSH needed (AWS Session Manager)
  • βœ… Stop when not using (save 97-98%!)

πŸ“˜ AWS README | GPU Compatibility Guide | Security Best Practices


πŸš€ Quick Start (One Command!)

# 1. Clone the repo
git clone https://github.com/sandbreak80/rag_lab.git
cd rag_lab/scripts

# 2. Run the clean deployment script
./clean-deploy.sh

This will:

  • βœ… Stop all containers & prune Docker
  • βœ… Build fresh images (no cache)
  • βœ… Start Ollama with GPU support
  • βœ… Pull required models (llama3.1:8b + nomic-embed-text)
  • βœ… Prompt for 8 optional models (for lab exercises)
  • βœ… Start all 14 microservices
  • βœ… Verify health checks

Total time: 15-30 minutes (depending on model downloads)

Quick Start (Existing Install)

cd rag_lab/scripts
./build-and-start.sh

No npm, Node.js, Python, or other host dependencies needed. Everything runs in Docker.

Time: ~5-10 minutes (first run with model downloads)

Access the Application

Stop Everything

cd scripts
./stop.sh

Clean Start (Fresh Install)

# Remove all data and rebuild
./build-and-start.sh --clean

Docker Compose Commands

# View logs
docker compose logs -f

# Restart a service
docker compose restart frontend

# Check service status
docker compose ps

πŸ“š Documentation


✨ Key Features

πŸŽ›οΈ Interactive Settings Panel

  • 6 Quick Presets: Minimal β†’ Fast β†’ Balanced β†’ Quality β†’ Maximum β†’ Production
  • 6 RAG Toggles: Query Expansion, BM25, Hybrid, Knowledge Graph, Re-ranking, Web Search
  • 4 LLM Settings: Model selection, Temperature, Max Tokens, Context Window
  • Real-time Preview: See expected performance before running

πŸ“Š Real-time Metrics Dashboard

  • Component Breakdown: See exactly where time is spent
  • Performance Tracking: Latency, precision, recall estimates
  • Visual Indicators: Color-coded status and percentage breakdowns
  • Expandable Details: Deep dive into each component's performance

βš–οΈ A/B Comparison Mode

  • Side-by-side Comparison: Test two configurations simultaneously
  • Automatic Winner: System determines the better config
  • Intelligent Insights: AI-generated analysis of differences
  • One-click Switch: Apply either configuration instantly

πŸ“– Progressive Lab Guide

  • 6 Interactive Sections: From beginner to advanced
  • Progress Tracking: Save your learning progress
  • Hands-on Activities: Learn by doing
  • Checkpoints: Verify understanding at each step

πŸ“Š Configuration Presets

PresetLatencyPrecisionRecallUse Case
Minimal40ms65%55%Baseline, speed tests
Fast60ms70%60%High QPS, autocomplete
Balanced ⭐120ms87%82%Recommended for learning
Quality250ms92%88%Research, complex queries
Maximum2500ms96%92%Best possible quality
Production πŸ†300ms94%90%Deploy this!

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     WEB UI (Port 5555)                       β”‚
β”‚  Settings Panel | Metrics Dashboard | Comparison | Lab Guide β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                  β”‚                  β”‚
    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
    β”‚  Search   β”‚     β”‚   Ingest   β”‚    β”‚  Vector   β”‚
    β”‚  Service  β”‚     β”‚  Service   β”‚    β”‚    DB     β”‚
    β”‚  (8002)   β”‚     β”‚   (8001)   β”‚    β”‚  (8005)   β”‚
    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
    β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                   β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Knowledgeβ”‚  β”‚  Reranker   β”‚  β”‚   Web Search    β”‚
β”‚  Graph  β”‚  β”‚   (8008)    β”‚  β”‚ (8009 + 8080)   β”‚
β”‚ (8007)  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Ollama (LLM)  β”‚
              β”‚    (11434)     β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

10 Microservices working together to provide a complete RAG experience.

πŸ“– Full Architecture Documentation: docs/ARCHITECTURE.md


πŸŽ“ Learning Path

1. Interactive Lab Guide (1-2 hours)

Built into the UI (πŸ“– button) with 6 progressive sections:

  1. Getting Started - Understand the interface
  2. Your First Query - Execute searches
  3. Understanding Metrics - Read performance data
  4. Configuration Experiments - A/B testing
  5. Advanced Features - Graph, re-ranking, web search
  6. Production Configuration - Deploy-ready system

2. Student Exercises (3-4 hours)

10 comprehensive exercises with grading rubric:

  • Exercise 1: Baseline Performance
  • Exercise 2: Hybrid Search Benefits
  • Exercise 3: Performance Profiling
  • Exercise 4: Re-ranking Trade-offs
  • Exercise 5: Web Search Integration
  • Exercise 6: Configuration Optimization
  • Exercise 7: A/B Testing
  • Exercise 8: Production Deployment
  • Exercise 9: Cost Analysis
  • Exercise 10: Final Challenge

πŸ“– Student Exercises: docs/lab/STUDENT_EXERCISES.md

3. Technical Deep Dive

Complete system documentation:

  • Architecture and design patterns
  • API reference for all endpoints
  • Performance benchmarks
  • Deployment guides
  • Development practices

πŸ“– Comprehensive Documentation: docs/COMPREHENSIVE_DOCUMENTATION.md


πŸ› οΈ Technology Stack

  • Backend: Python, Flask
  • Vector Database: ChromaDB
  • LLM: Ollama (llama3.2)
  • Search: Hybrid (Vector + BM25)
  • Knowledge Graph: NetworkX
  • Web Search: SearXNG
  • Document Processing: Docling
  • Containerization: Docker & Docker Compose
  • Frontend: Vanilla JavaScript, CSS

πŸ“¦ What's Included

rag_lab/
β”œβ”€β”€ docs/                          # Documentation
β”‚   β”œβ”€β”€ lab/                       # Student learning materials
β”‚   β”‚   β”œβ”€β”€ QUICK_START.md         # 5-minute setup
β”‚   β”‚   β”œβ”€β”€ LAB_GUIDE.md           # Interactive guide
β”‚   β”‚   β”œβ”€β”€ STUDENT_EXERCISES.md   # 10 exercises
β”‚   β”‚   └── LAB_OBJECTIVES.md      # Learning goals
β”‚   β”œβ”€β”€ development/               # Developer docs
β”‚   β”œβ”€β”€ deployment/                # Deployment guides
β”‚   └── COMPREHENSIVE_DOCUMENTATION.md
β”œβ”€β”€ services/                      # 10 microservices
β”‚   β”œβ”€β”€ search/                    # Hybrid search orchestration
β”‚   β”œβ”€β”€ vector-db/                 # ChromaDB wrapper
β”‚   β”œβ”€β”€ ingest/                    # Document processing
β”‚   β”œβ”€β”€ knowledge-graph/           # Graph service
β”‚   β”œβ”€β”€ reranker/                  # LLM re-ranking
β”‚   β”œβ”€β”€ web-search/                # SearXNG wrapper
β”‚   └── ...
β”œβ”€β”€ src/                           # Web UI
β”‚   β”œβ”€β”€ webapp.py                  # Flask server
β”‚   β”œβ”€β”€ templates/                 # HTML templates
β”‚   └── static/                    # CSS, JavaScript
β”œβ”€β”€ config/                        # Configuration
β”‚   β”œβ”€β”€ presets.json               # 6 presets
β”‚   └── searxng/                   # SearXNG config
β”œβ”€β”€ tests/                         # Integration tests
β”‚   └── test_integration.py        # 20+ tests (no mocks)
β”œβ”€β”€ docker-compose.test.yml        # Orchestration
└── README.md                      # This file

πŸ§ͺ Testing

Run the integration test suite (no mocks, real services):

# Services must be running
docker-compose -f docker-compose.test.yml up -d

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install pytest requests

# Run tests
pytest tests/test_integration.py -v

20+ integration tests covering:

  • Service health checks
  • Configurable search with all presets
  • Web search integration
  • Knowledge graph
  • LLM re-ranking
  • End-to-end RAG flow
  • Metrics accuracy

πŸ“š Documentation

DocumentDescription
Quick StartGet running in 5 minutes
Lab GuideInteractive learning guide
Student Exercises10 hands-on exercises
Comprehensive DocsComplete technical reference
ArchitectureSystem design
API ReferenceAll endpoints
DeploymentProduction deployment
Context RecoveryQuick reference
Project ReportFinal status

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for:

  • Code of conduct
  • How to submit issues
  • Pull request process
  • Development setup
  • Coding standards

πŸ“‹ Requirements

  • Docker and Docker Compose
  • Ollama running locally (port 11434)
  • 8GB+ RAM (recommended)
  • 10GB+ disk space
  • Python 3.8+ (for testing)

πŸ› Troubleshooting

Services Won't Start

docker ps
docker logs rag-web-ui

Ollama Connection Failed

curl http://localhost:11434/api/tags

No Search Results

Upload documents first via the UI (drag-and-drop).

Web Search Timeout

Check SearXNG: curl http://localhost:8080/search?q=test&format=json

πŸ“– Full Troubleshooting Guide: docs/COMPREHENSIVE_DOCUMENTATION.md#troubleshooting


πŸ“„ License

MIT License - see LICENSE file for details.

TL;DR: Free to use, modify, and deploy. Including commercially.


πŸ™ Acknowledgments

Built with:


πŸ“ž Support & Community


🎯 Project Status

βœ… Production Ready (v1.0.0)

  • βœ… All 10 microservices operational
  • βœ… All 6 presets tested
  • βœ… Complete documentation (40,000+ words)
  • βœ… Student exercises ready
  • βœ… Integration tests passing
  • βœ… Web search integrated
  • βœ… A/B comparison working
  • βœ… Lab guide complete

πŸš€ Next Steps

  1. Quick Start: docs/lab/QUICK_START.md
  2. Open UI: http://localhost:5555
  3. Follow Lab Guide: Click πŸ“– button in UI
  4. Complete Exercises: docs/lab/STUDENT_EXERCISES.md
  5. Deploy: Use Production preset πŸ†

⭐ Star this repo if you find it useful!

Built with ❀️ for education

Educational RAG Lab v1.0.0 - Interactive Learning Environment for RAG Systems

Contributors

bmstoner

260 commits

sandbreak80

32 commits

sandbreak80/rag_lab

0

stars

292

commits

Python

primary language

Nov 19, 2025

updated

README

πŸŽ“ Educational RAG Lab

An enterprise-grade RAG system for learning and experimentation - Built with modern AI architecture

License: MIT Python 3.11+ Docker Status Version

πŸ“˜ Read Current Status | View Changelog - Latest features and improvements


🌟 What is This?

The Educational RAG Lab is a production-ready reference architecture for LLM deployments, designed for hands-on learning and customer demonstrations. It features:

  • 14 Microservices - Complete production-grade RAG architecture
  • Modern React UI - TypeScript, Tailwind CSS, real-time streaming
  • Performance Waterfall Chart - Visualize RAG pipeline latency breakdown
  • Authentication System - JWT-based user auth with security controls
  • Citation Validation - Hallucination detection for accurate sourcing
  • Baseline Prompts - Pre-built queries for performance testing
  • Configuration Toggles - UI controls for all RAG features
  • Security Guardrails - PII detection, rate limiting, input sanitization
  • Research Agent - Autonomous AI paper discovery and ingestion
  • Comprehensive Documentation - Architecture, deployment, testing guides

Unique Value:

"This isn't just a RAG lab - it's a reference architecture for production LLM deployments, instrumented for Splunk from day one."

Perfect for:

  • 🎯 Splunk/Cisco Field Teams - Architects, SEs, Sales Leaders
  • πŸŽ“ Students - Learning RAG, LLMs, and production AI
  • πŸ‘¨β€πŸ« Instructors - Teaching enterprise AI deployment
  • πŸ”¬ Researchers - Experimenting with RAG configurations
  • πŸ‘¨β€πŸ’» Developers - Building production RAG systems

Launch on GPU-enabled EC2 with automated setup:

With vLLM Support (g5.2xlarge - NVIDIA A10G)

cd aws/scripts
./setup-github-secret.sh  # One-time security setup
./launch-g5-vllm.sh        # Launch with vLLM + Ollama
  • βœ… vLLM - 2x faster inference (Ampere GPU)
  • βœ… 24GB VRAM - Larger models (13B+)
  • βœ… Cost: ~$29/day running, ~$0.65/day stopped

Ollama Only (g4dn.2xlarge - NVIDIA T4)

cd aws/scripts
./setup-github-secret.sh   # One-time security setup
./aws-launch-rag-lab.sh    # Launch with Ollama
  • βœ… Ollama - Cost-effective development
  • βœ… 16GB VRAM - Small/medium models (7B)
  • βœ… Cost: ~$18/day running, ~$0.50/day stopped

Features:

  • βœ… Automated deployment (10-20 minutes)
  • βœ… Secure private repo access (AWS Secrets Manager)
  • βœ… No SSH needed (AWS Session Manager)
  • βœ… Stop when not using (save 97-98%!)

πŸ“˜ AWS README | GPU Compatibility Guide | Security Best Practices


πŸš€ Quick Start (One Command!)

# 1. Clone the repo
git clone https://github.com/sandbreak80/rag_lab.git
cd rag_lab/scripts

# 2. Run the clean deployment script
./clean-deploy.sh

This will:

  • βœ… Stop all containers & prune Docker
  • βœ… Build fresh images (no cache)
  • βœ… Start Ollama with GPU support
  • βœ… Pull required models (llama3.1:8b + nomic-embed-text)
  • βœ… Prompt for 8 optional models (for lab exercises)
  • βœ… Start all 14 microservices
  • βœ… Verify health checks

Total time: 15-30 minutes (depending on model downloads)

Quick Start (Existing Install)

cd rag_lab/scripts
./build-and-start.sh

No npm, Node.js, Python, or other host dependencies needed. Everything runs in Docker.

Time: ~5-10 minutes (first run with model downloads)

Access the Application

Stop Everything

cd scripts
./stop.sh

Clean Start (Fresh Install)

# Remove all data and rebuild
./build-and-start.sh --clean

Docker Compose Commands

# View logs
docker compose logs -f

# Restart a service
docker compose restart frontend

# Check service status
docker compose ps

πŸ“š Documentation


✨ Key Features

πŸŽ›οΈ Interactive Settings Panel

  • 6 Quick Presets: Minimal β†’ Fast β†’ Balanced β†’ Quality β†’ Maximum β†’ Production
  • 6 RAG Toggles: Query Expansion, BM25, Hybrid, Knowledge Graph, Re-ranking, Web Search
  • 4 LLM Settings: Model selection, Temperature, Max Tokens, Context Window
  • Real-time Preview: See expected performance before running

πŸ“Š Real-time Metrics Dashboard

  • Component Breakdown: See exactly where time is spent
  • Performance Tracking: Latency, precision, recall estimates
  • Visual Indicators: Color-coded status and percentage breakdowns
  • Expandable Details: Deep dive into each component's performance

βš–οΈ A/B Comparison Mode

  • Side-by-side Comparison: Test two configurations simultaneously
  • Automatic Winner: System determines the better config
  • Intelligent Insights: AI-generated analysis of differences
  • One-click Switch: Apply either configuration instantly

πŸ“– Progressive Lab Guide

  • 6 Interactive Sections: From beginner to advanced
  • Progress Tracking: Save your learning progress
  • Hands-on Activities: Learn by doing
  • Checkpoints: Verify understanding at each step

πŸ“Š Configuration Presets

PresetLatencyPrecisionRecallUse Case
Minimal40ms65%55%Baseline, speed tests
Fast60ms70%60%High QPS, autocomplete
Balanced ⭐120ms87%82%Recommended for learning
Quality250ms92%88%Research, complex queries
Maximum2500ms96%92%Best possible quality
Production πŸ†300ms94%90%Deploy this!

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     WEB UI (Port 5555)                       β”‚
β”‚  Settings Panel | Metrics Dashboard | Comparison | Lab Guide β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚                  β”‚                  β”‚
    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
    β”‚  Search   β”‚     β”‚   Ingest   β”‚    β”‚  Vector   β”‚
    β”‚  Service  β”‚     β”‚  Service   β”‚    β”‚    DB     β”‚
    β”‚  (8002)   β”‚     β”‚   (8001)   β”‚    β”‚  (8005)   β”‚
    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
    β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                   β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Knowledgeβ”‚  β”‚  Reranker   β”‚  β”‚   Web Search    β”‚
β”‚  Graph  β”‚  β”‚   (8008)    β”‚  β”‚ (8009 + 8080)   β”‚
β”‚ (8007)  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Ollama (LLM)  β”‚
              β”‚    (11434)     β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

10 Microservices working together to provide a complete RAG experience.

πŸ“– Full Architecture Documentation: docs/ARCHITECTURE.md


πŸŽ“ Learning Path

1. Interactive Lab Guide (1-2 hours)

Built into the UI (πŸ“– button) with 6 progressive sections:

  1. Getting Started - Understand the interface
  2. Your First Query - Execute searches
  3. Understanding Metrics - Read performance data
  4. Configuration Experiments - A/B testing
  5. Advanced Features - Graph, re-ranking, web search
  6. Production Configuration - Deploy-ready system

2. Student Exercises (3-4 hours)

10 comprehensive exercises with grading rubric:

  • Exercise 1: Baseline Performance
  • Exercise 2: Hybrid Search Benefits
  • Exercise 3: Performance Profiling
  • Exercise 4: Re-ranking Trade-offs
  • Exercise 5: Web Search Integration
  • Exercise 6: Configuration Optimization
  • Exercise 7: A/B Testing
  • Exercise 8: Production Deployment
  • Exercise 9: Cost Analysis
  • Exercise 10: Final Challenge

πŸ“– Student Exercises: docs/lab/STUDENT_EXERCISES.md

3. Technical Deep Dive

Complete system documentation:

  • Architecture and design patterns
  • API reference for all endpoints
  • Performance benchmarks
  • Deployment guides
  • Development practices

πŸ“– Comprehensive Documentation: docs/COMPREHENSIVE_DOCUMENTATION.md


πŸ› οΈ Technology Stack

  • Backend: Python, Flask
  • Vector Database: ChromaDB
  • LLM: Ollama (llama3.2)
  • Search: Hybrid (Vector + BM25)
  • Knowledge Graph: NetworkX
  • Web Search: SearXNG
  • Document Processing: Docling
  • Containerization: Docker & Docker Compose
  • Frontend: Vanilla JavaScript, CSS

πŸ“¦ What's Included

rag_lab/
β”œβ”€β”€ docs/                          # Documentation
β”‚   β”œβ”€β”€ lab/                       # Student learning materials
β”‚   β”‚   β”œβ”€β”€ QUICK_START.md         # 5-minute setup
β”‚   β”‚   β”œβ”€β”€ LAB_GUIDE.md           # Interactive guide
β”‚   β”‚   β”œβ”€β”€ STUDENT_EXERCISES.md   # 10 exercises
β”‚   β”‚   └── LAB_OBJECTIVES.md      # Learning goals
β”‚   β”œβ”€β”€ development/               # Developer docs
β”‚   β”œβ”€β”€ deployment/                # Deployment guides
β”‚   └── COMPREHENSIVE_DOCUMENTATION.md
β”œβ”€β”€ services/                      # 10 microservices
β”‚   β”œβ”€β”€ search/                    # Hybrid search orchestration
β”‚   β”œβ”€β”€ vector-db/                 # ChromaDB wrapper
β”‚   β”œβ”€β”€ ingest/                    # Document processing
β”‚   β”œβ”€β”€ knowledge-graph/           # Graph service
β”‚   β”œβ”€β”€ reranker/                  # LLM re-ranking
β”‚   β”œβ”€β”€ web-search/                # SearXNG wrapper
β”‚   └── ...
β”œβ”€β”€ src/                           # Web UI
β”‚   β”œβ”€β”€ webapp.py                  # Flask server
β”‚   β”œβ”€β”€ templates/                 # HTML templates
β”‚   └── static/                    # CSS, JavaScript
β”œβ”€β”€ config/                        # Configuration
β”‚   β”œβ”€β”€ presets.json               # 6 presets
β”‚   └── searxng/                   # SearXNG config
β”œβ”€β”€ tests/                         # Integration tests
β”‚   └── test_integration.py        # 20+ tests (no mocks)
β”œβ”€β”€ docker-compose.test.yml        # Orchestration
└── README.md                      # This file

πŸ§ͺ Testing

Run the integration test suite (no mocks, real services):

# Services must be running
docker-compose -f docker-compose.test.yml up -d

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install pytest requests

# Run tests
pytest tests/test_integration.py -v

20+ integration tests covering:

  • Service health checks
  • Configurable search with all presets
  • Web search integration
  • Knowledge graph
  • LLM re-ranking
  • End-to-end RAG flow
  • Metrics accuracy

πŸ“š Documentation

DocumentDescription
Quick StartGet running in 5 minutes
Lab GuideInteractive learning guide
Student Exercises10 hands-on exercises
Comprehensive DocsComplete technical reference
ArchitectureSystem design
API ReferenceAll endpoints
DeploymentProduction deployment
Context RecoveryQuick reference
Project ReportFinal status

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for:

  • Code of conduct
  • How to submit issues
  • Pull request process
  • Development setup
  • Coding standards

πŸ“‹ Requirements

  • Docker and Docker Compose
  • Ollama running locally (port 11434)
  • 8GB+ RAM (recommended)
  • 10GB+ disk space
  • Python 3.8+ (for testing)

πŸ› Troubleshooting

Services Won't Start

docker ps
docker logs rag-web-ui

Ollama Connection Failed

curl http://localhost:11434/api/tags

No Search Results

Upload documents first via the UI (drag-and-drop).

Web Search Timeout

Check SearXNG: curl http://localhost:8080/search?q=test&format=json

πŸ“– Full Troubleshooting Guide: docs/COMPREHENSIVE_DOCUMENTATION.md#troubleshooting


πŸ“„ License

MIT License - see LICENSE file for details.

TL;DR: Free to use, modify, and deploy. Including commercially.


πŸ™ Acknowledgments

Built with:


πŸ“ž Support & Community


🎯 Project Status

βœ… Production Ready (v1.0.0)

  • βœ… All 10 microservices operational
  • βœ… All 6 presets tested
  • βœ… Complete documentation (40,000+ words)
  • βœ… Student exercises ready
  • βœ… Integration tests passing
  • βœ… Web search integrated
  • βœ… A/B comparison working
  • βœ… Lab guide complete

πŸš€ Next Steps

  1. Quick Start: docs/lab/QUICK_START.md
  2. Open UI: http://localhost:5555
  3. Follow Lab Guide: Click πŸ“– button in UI
  4. Complete Exercises: docs/lab/STUDENT_EXERCISES.md
  5. Deploy: Use Production preset πŸ†

⭐ Star this repo if you find it useful!

Built with ❀️ for education

Educational RAG Lab v1.0.0 - Interactive Learning Environment for RAG Systems

Contributors

bmstoner

260 commits

sandbreak80

32 commits

Languages

Python

53.3%

TypeScript

25.7%

Shell

10.1%

HTML

8.0%

CSS

2.1%