~/projects

Legal RAG Assistant

A full-stack retrieval-augmented generation pipeline for context-aware legal analysis on UK Contract Law and user-uploaded documents, with multi-user data isolation.

PythonLangChainChromaDBLlama 3.1Docker
Legal RAG Assistant

Overview

A local-first RAG system built for legal document analysis, designed to handle multi-user uploads with strict data isolation.

What it does

  • Hybrid vector store using ChromaDB and nomic-embed-text with metadata-based namespacing for multi-user isolation
  • Llama 3.1 with sliding-window chat memory for long-context legal queries
  • Custom prompt engineering for coherent reasoning across complex contract law questions
  • Fully containerised with Docker Compose orchestrating Streamlit, Ollama, and ChromaDB

The lesson

Namespacing in a shared vector store is non-trivial — without it, retrieval bleeds across user sessions. The metadata filter layer added latency but was non-negotiable for correctness.