Inspiration

Most official paperwork isn't written for the person who has to deal with it. A scholarship notice hides its deadline halfway down page three. An insurance policy keeps its exclusions for the fine print at the end. A lot of people (me included, at some point) apply or sign things without really knowing what they agreed to.

I didn't just want a tool that summarises a PDF. I wanted one that also shows where it got each answer, so you don't have to trust the AI blindly. That became the idea behind the project: understand it, verify it, act on it.

What it does

You upload a PDF, either a normal digital file or a scanned copy. DocIntel AI then:

  • works out what kind of document it is and gives you a short summary in plain language
  • pulls out eligibility rules, deadlines, fees, required documents, important clauses and risks
  • turns all of that into a simple checklist of what to do next
  • lets you ask questions, and answers only from your document (if the answer isn't in there, it says so)
  • puts a page number on every fact and answer, and clicking it opens the original PDF at that page

How I built it

The backend runs on FastAPI. When a PDF comes in, PyMuPDF reads the text page by page. If a file has almost no selectable text, the app assumes it's a scan and sends it through Tesseract OCR instead. Either way, each piece of text keeps its page number.

Next, the text is cut into overlapping chunks, embedded, and stored in a FAISS index. When someone asks a question, the closest chunks (with their page numbers) go to the language model along with strict instructions: use only this evidence, and return the answer plus the pages it came from. The React dashboard shows everything as cards, and each citation reloads the PDF viewer at #page=N.

There's a little maths behind retrieval. Chunks overlap so a sentence sitting on a boundary doesn't get lost. With 1000-word chunks and a 150-word overlap, every chunk starts

$$\text{stride} = 1000 - 150 = 850 \text{ words}$$

after the one before it. For searching, I normalise every vector, which means the inner product FAISS calculates is the same as the cosine similarity between a question \( q \) and a chunk \( c_i \):

$$\text{score}(q, c_i) = \frac{q \cdot c_i}{\lVert q \rVert \, \lVert c_i \rVert} = \cos\theta$$

Challenges I ran into

  • Keeping the page number attached. Citations only work if the page travels with the text through extraction, chunking, retrieval and the final answer. If it drops out anywhere, you can't verify anything. So I made the page part of every chunk from the start.
  • Scanned vs. digital PDFs. My rule is blunt: if direct extraction finds fewer than 100 characters, switch to OCR. It's fine for an MVP, but it's not a proper detector.
  • Getting the model to stop guessing. I wrote the prompts to forbid outside knowledge and to give one fixed reply when the answer is missing. Then I tested it with questions I knew weren't in the file.
  • Messy JSON. Sometimes the model returns text that isn't valid JSON, so I added fallbacks to keep the app running instead of crashing.

What I learned

  • RAG cuts down on made-up answers, but it doesn't remove them. Showing the source page matters as much as the answer itself.
  • A small feature like a clickable citation can be what makes people trust a tool.
  • Building one stage at a time (upload, extraction, OCR, AI, RAG, UI) and running the code after each one made bugs much easier to track down.

What's next

  • Highlight the exact sentence in the PDF instead of just opening the page
  • Save documents in a database rather than server memory
  • Add OCR confidence checks and hybrid keyword + vector search
  • User accounts, a delete-document option and multilingual support (Hindi and Odia would be great)

DocIntel AI is an information assistant, not a replacement for legal, financial or professional advice. Always check important decisions against the original document.

Built With

Share this project:

Updates

Submission history