Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Community: Load a PDF document as per its Table of Contents #28346

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

vineetm
Copy link

@vineetm vineetm commented Nov 26, 2024

Description: Many PDFs such as textbooks come with a rich Table of Contents (also known as bookmarks). It would be helpful for a RAG system to see the entire content for a ToC entry in tandem, rather than limiting it to a single PDF page!

This PR adds adds a new PDF document loader which loads content of PDF by using its Table of Contents

Many PDFs have detailed Table of Contents. For example this book with the pdf has this Table of Contents structure...
Screenshot 2024-11-26 at 1 30 37 PM

PyPfium2Loader breaks the flow of content which logically continues on the next page.

This PR, loads content based on Toc entry. It can

  1. Extract logical chunks within a single page
  2. Extract logical chunks of document spanning across multiple pages
  3. Is not limited by the page scope

Copy link

vercel bot commented Nov 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 3:32pm

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. community Related to langchain-community Ɑ: doc loader Related to document loader module (not documentation) labels Nov 26, 2024
@efriis
Copy link
Member

efriis commented Dec 9, 2024

I don't fully understand what this does (it looks like the docs page you added isn't actually populated), but I think it's unnecessary to add another PDF document loader because we have so many. Depending what the goal of loading in the TOC in this way is, couldn't this be added as some kind of postprocessing on documents in a guide instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community Ɑ: doc loader Related to document loader module (not documentation) size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Needs support
Development

Successfully merging this pull request may close these issues.

2 participants