RAG-powered AI assistant over South African labour law documents. Built with LangChain, ChromaDB, and FastAPI. Foundation for MatterMind legal AI platform.
# SALLI — SA Labour Law Investigator
A RAG-powered AI assistant for South African labour law. Ask natural-language questions and receive accurate, cited answers grounded in trusted source documents — the LRA, BCEA, EEA, CCMA rules, and associated Codes of Good Practice.
Built as part of **MatterMind** — an AI legal intelligence platform for SA labour law firms, co-founded with **Patrick Deale**, Acting Judge of the SA Labour Court, veteran labour lawyer, and co-author of the *Labour Relations Handbook* (Juta).
---
## Features
- **Retrieval-Augmented Generation** — answers are grounded in actual legal text, not hallucinated. Every response cites the source document and page number.
- **LangChain RetrievalQA chain** with `temperature=0` for deterministic, non-speculative answers appropriate to a legal context.
- **HuggingFace `all-MiniLM-L6-v2`** for local, zero-cost semantic embeddings — no API key required.
- **ChromaDB persistent vector store** — embeddings are computed once and reused across restarts. Ingest and serve are fully decoupled processes.
- **Chunking strategy tuned for legal text** — `RecursiveCharacterTextSplitter` with 1000-char chunks and 200-char overlap preserves sentence context while keeping each chunk topically focused.
- **FastAPI with Pydantic v2** request/response models, input validation, and OpenAPI docs out of the box.
- **Lifespan-managed startup** — retriever is initialised at server boot, not on first request. Cold-start latency is server startup time, not first-query time.
- **Production-ready error handling** — 503 when vectorstore is unready, 422 on bad input, global exception handler prevents stack trace leaks.
- **Layered architecture** designed for MatterMind integration — the retriever module is the clean seam for adding multi-source retrieval, reranking, and trust-weighted collections.
---
## Architecture
```
┌─────────────────────────────────┐
│ Client / MatterMind │
└────────────────┬────────────────┘ …