on-internet
← Community

How to get bounding boxes (BBox) for chunks in a RAG Pipeline to highlight top 5 retrieved chunks in a PDF document?

Stack Overflow ·

I'm working on a RAG (retrieval-augmented generation) pipeline, where I first preprocess a PDF document and split it into chunks. When running the RAG process, I retrieve the top 5 chunks and generate an answer. To provide context, I want to highlight these 5 chunks in the original PDF document. I'm using the pdf.js library on the frontend, which can technically highlight text, but I'm facing two issues: How do I connect the bounding boxes to the chunks after splitting the PDF? How do I handle situations where bounding boxes overlap across pages? For context, I am using Haystack AI and Python

Comments

Sign in or sign up to comment and upvote.

No comments yet.