How I Built LexiQ: From Long Legal PDFs to Cited AI Answers
A build story about turning dense legal documents into a usable RAG workflow with citations, risk flags, and careful output design.
Plain-English takeaway
The hardest part of legal AI is not calling a model. It is making the answer inspectable, cautious, and useful.
Part 01
The Starting Point
Legal PDFs create a very specific kind of friction. The user is not asking for entertainment. They are trying to understand responsibility, risk, dates, penalties, rights, and obligations.
A loose summary can be dangerous here. The app needs to point back to the document and avoid sounding more certain than the source allows.
Part 02
The Product Shape
LexiQ follows a simple path: upload a PDF, extract text, retrieve relevant chunks, ask the LLM a focused question, and return an answer with page references and risk labels.
The design goal is review speed. A user should be able to scan the answer, check the evidence, and decide whether to inspect the original page.
- PyMuPDF for PDF parsing
- ChromaDB for semantic retrieval
- LangGraph for orchestration
- Focused prompts for cautious answers
- Citations and page references for review
- Risk flags to guide attention
Part 03
What I Learned
The model call is only one part of the system. The real engineering is in boundaries: what to retrieve, what to show, what to avoid, and how to make the answer easy to challenge.
That is the difference between a demo and a product workflow.