Menu

Can your RAG answer point back to the right PDF page?
📰

Can your RAG answer point back to the right PDF page?

DEV Community: python·Derek·16 days ago
#jWBs1a6C
#devtopython#devto#dev#json#pages
Long article (974 words) — no AI summary yet.
Reading 0:00
15s threshold

A correct-looking answer is difficult to review if its citation opens the wrong PDF page. This can happen when several pages share the same heading, or when a pipeline discards page metadata before chunking.

Here is a small check to run before adding a vector database. It uses a two-page teaching PDF and an actual ComPDF parsing result. It checks source mapping; it does not benchmark retrieval or prove that an LLM answers correctly.

Make the two pages deliberately similar

Use a heading of “Return policy” on both pages. Page 1 says “Domestic returns” and “Request a return within 14 days of delivery.” Page 2 says “International returns” and “Request a return within 30 days of delivery.” Export this as a text PDF.

The shared heading matters: it cannot identify the right source on its own. You need the document version and page attached to the relevant text.

Inspect the parser output before flattening it

The ComPDF document parsing API returns structured document content.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.