Index

RAG chatbot for Legal documents

Grounding answers in a legal archive
Cat. 005 — Series A

Oct — Dec 2023 MANE
Python · LangChain
Local open-source LLMs
Corpus
Ingest
Embed
Index
Query
Retrieve
Ground

01 — Corpus

The archive is thousands of pages long.

Contracts, amendments, policies, precedent. Searchable only by someone who already knows where to look — which is the whole problem.

02 — Ingest

Every document is cut into passages.

Ingestion normalises the formats, then splits each document into overlapping chunks — small enough to reason about, large enough to keep the clause they came from intact.

03 — Embed

Each passage becomes a vector.

An open-source embedding model maps text into a space where distance means similarity. It runs locally: no clause in this archive is ever sent to an API.

Model open-sourceRuntime local

04 — Index

Similar clauses land near each other.

The corpus organises itself. Indemnity settles beside indemnity, termination beside termination, without anyone having labelled a single document.

05 — Query

A question enters the same space.

The question is embedded with the identical model, so it can be compared against every passage on exactly the same terms.

06 — Retrieve

The nearest passages are pulled back.

Top-k by cosine distance. Retrieval was tuned with the legal team directly, because "close enough" is not a standard that survives a contract review.

Rank cosineReturned top-k

07 — Ground

The answer is written from those passages, and cites them.

The model sees only what was retrieved. Every claim traces back to a document, and nothing is invented to cover a gap in the archive.

CAT. 005 LEGAL RAG ARCHIVE (SERIES A)
METHOD RETRIEVAL AUGMENTED GENERATION
INPUT LEGAL CORPUS PDF / DOCX
OUTPUT GROUNDED ANSWER WITH CITATIONS
CYANOTYPE ONE PIGMENT 3 EXPOSURES
loading plate