ClaimSense
An LLM reads the insurance claim; plain code decides where it goes
Upload a First Notice of Loss as a PDF or text file. pdfplumber extracts the text, an LLM on NVIDIA NIM fills a Pydantic schema, and a deterministic rules engine routes the claim to fast track, manual review, the specialist queue or investigation, with a written reason.
- 4 routing outcomes
- Temperature 0
- Schema-validated output
- 5 req/min per IP
§1
The problem
Claims handlers read every FNOL document to pull out the same fields and choose a queue. LLMs are good at reading messy documents, but a routing decision has to be explainable and repeatable.
§2
My role
Sole developer: document parser, extraction agent, routing engine, rate limiter and the single-page dashboard.
§3
Architecture
§4
Key decisions
D/01
AI extracts, code decides
The LLM only fills in the schema. Routing is ordinary Python that a reviewer can read, test and audit.
D/02
The schema is the prompt
The Pydantic model's JSON Schema is sent with the document at temperature 0, and the reply is validated with model_validate before anything uses it.
D/03
Rules in priority order
Missing mandatory fields → manual review; fraud words (staged, suspicious, inconsistent…) → investigation; any injury → specialist queue; under $25,000 → fast track; otherwise manual review.
D/04
Protect the LLM quota
A sliding-window middleware allows 5 requests a minute per IP on /api/process and 30 elsewhere, returning 429 beyond that.
§5
Challenges
- Models wrap JSON in markdown fences despite instructions, so the agent strips them before parsing and fails clearly when the output still isn't valid.
- Injury detection treats "none", "no" and "n/a" as no injury, so the way an LLM writes "nothing" doesn't send a claim to the specialist queue.
- Processed claims are kept in localStorage, so the dashboard keeps its history without a database.
§6
Stack
- Python
- FastAPI
- Pydantic
- NVIDIA NIM
- pdfplumber
- JavaScript
Next case study
Procuro
RFPs written from one sentence, vendor replies parsed from email, bids compared