Dev Jhawar, home
Résumé ↗
← All projects

Project 04, 2026

PolicyLens

Ask questions of a policy PDF and get answers tied to the exact clause and page.

All services

PolicyLens screenshot

Interactive explainer

How an answer finds its clause

Ask a question of a short, made-up policy for this site. The best clause is quoted with its section and page, and a question the policy does not cover gets "not in this document".

This is a small model of one part of PolicyLens: how an answer is tied to the exact clause and page, using keyword search only where the real app also uses vectors, a reranker and an LLM. It runs in your browser on sample data and doesn't fetch anything or call an AI model, so it isn't the app itself.Use the real PolicyLens ↗

Try

Pick a question above or type your own. The answer and the clause it came from show up here.

Terms of visiting devjhawar.com

Page 1

Definitions

1.1 "Visitor" means anyone reading this site. "Dev" means the person who built it.

1.2 A "demo" is any part of this site that moves when you click it.

Use of the site

2.1 Visitor may read every page free of charge, as many times as they like.

2.2 Visitor may borrow CSS and layout ideas, provided they link back to this site.

Page 2

Use of the site

2.3 Scraping is permitted at under one request per second. Polite agents are welcome.

Contact

3.1 Email is the best way to reach Dev. Replies follow India time (IST).

3.2 Messages sent between 02:00 and 08:00 IST are answered after Dev wakes up.

3.3 Recruiters and collaborators may reach Dev by email or LinkedIn.

Page 3

Privacy

4.1 This site sets no tracking cookies and runs no third-party analytics.

4.2 Your light or dark theme choice is saved in your own browser and never sent anywhere.

Liability

5.1 Dev is not liable for time lost playing with the demos.

5.2 Dark mode is provided as is, with no warranty of being easier on the eyes.

Insurance and policy documents are long and easy to misread. PolicyLens lets you ask the document questions and check each answer against the cited clause.

What I built

PolicyLens lets you upload an insurance or policy PDF and ask questions in plain English. Each answer points to the section and page it came from, and clicking the source opens the PDF at that page with the clause highlighted. If the document does not contain the answer, it says so. It also has summaries and a compare mode that asks one question across several policies.

This repo is a fork of arpanz/policylens. I built the RAG engine in it (pull requests #1, #2 and #4, all merged); the web app and the rest of the project are the original author’s work.

How it works

Uploading stores the PDF and queues a job. A worker reads the PDF, chunks it along its own headings, embeds the chunks and writes a summary. A question runs vector and BM25 search, merges them with reciprocal-rank fusion, reranks, and gives only the top passages to the language model, which streams the answer back with its sources.

Decisions worth noting

  • Chunks follow the document’s headings, so a chunk is one clause or table row that remembers its section and page.
  • Questions and passages use separate embedding modes, and keyword plus meaning search is merged rather than either alone.
  • The database is the job queue (FOR UPDATE SKIP LOCKED), and failed jobs retry three times before showing Failed.
  • Each policy’s chunks are ranked directly instead of through a shared approximate index, so one user’s data can’t crowd out another’s.
  • Hosted APIs handle embeddings and reranking, which keeps the server small.
Esc