How cam01h/manx-reg-rag works
manx-reg-rag is a retrieval-augmented Q&A application for Isle of Man AML/CFT legislation and guidance. A user submits a question through the web interface; the API restores conversation history, invokes an AI agent, and supplies retrieved passages and matched definitions so the answer can cite its sources. The documented preparation workflow converts source documents into structured chunks and definitions, then embeds and indexes them. The tree lacks the README-mentioned ingestion entry point, so preparation links show only supported stages; query wiring is based on sampled source.
Main entry points: process_documents.py Document processing · server.py FastAPI server · retrieval.py Chunk retrieval · app.js Web client
Components 17
Web interface
- Web client
web/app.js
Question answering
- FastAPI server
app/server.py - Session history
app/sessions.py - Answer agent
app/llm.py
Knowledge preparation
- Document processing
extraction_ops/process_documents.py - PDF extraction
extraction_ops/pdf_ops.py - Text normalization
extraction_ops/md_ops.py - Document rules
extraction_ops/toolbelts - Section chunking
extraction_ops/chunking.py - Definition extraction
extraction_ops/definitions.py
Retrieval index
- Chunk retrieval
db_ops/retrieval.py - Qdrant vector store
- Embedding and indexing
db_ops/embed.py
Other components
- Compliance user
- OpenAI model
- Legislation and guidance
- Dense and sparse models
Connections 22
- Compliance user → Web client: asks question
- Web client → FastAPI server: POST query
- FastAPI server → Session history: loads history
- Session history → FastAPI server: returns history
- FastAPI server → Answer agent: runs agent
- Answer agent → OpenAI model: generates answer
- Answer agent → Chunk retrieval: calls tool
- Chunk retrieval → Qdrant vector store: queries vectors
- Qdrant vector store → Chunk retrieval: returns passages
- Chunk retrieval → Answer agent: returns passages and definitions
- FastAPI server → Session history: saves turn
- FastAPI server → Web client: returns answer and citations
- Web client → Compliance user: displays results
- Legislation and guidance → Document processing: provides documents
- Document processing → PDF extraction: extracts PDF text
- Document processing → Text normalization: normalizes text
- Document processing → Document rules: applies document rules
- Document processing → Section chunking: creates chunks
- Document processing → Definition extraction: extracts definitions
- Embedding and indexing → Dense and sparse models: embeds chunks
- Embedding and indexing → Qdrant vector store: writes vectors
- Chunk retrieval → Dense and sparse models: embeds queries