Ask HN: What are you using to parse PDFs for RAG?
61–70 of 102 posts
Re: Ask HN: What are you using to parse PDFs for RAG?
#62For use in retrieval/RAG, an emerging paradigm is to not parse the PDF at all. By using a multi-modal foundation model, you convert visual representations ("screenshots") of the pdf directly into searchable vector representations. Paper: Efficient Document Retrieval with Vision Language Models - https://arxiv.org/abs/2407.01449 Vespa.ai blog post https://blog.vespa.ai/retrieval-with-vision-language-models-... (my day…
Re: Ask HN: What are you using to parse PDFs for RAG?
#63For use in retrieval/RAG, an emerging paradigm is to not parse the PDF at all. By using a multi-modal foundation model, you convert visual representations ("screenshots") of the pdf directly into searchable vector representations. Paper: Efficient Document Retrieval with Vision Language Models - https://arxiv.org/abs/2407.01449 Vespa.ai blog post https://blog.vespa.ai/retrieval-with-vision-language-models-... (my day…
1. Render first 2 pages of PDF into a JPEG offline in the Mac app.
2. Upload JPEG to ChatGPT Vision and ask what would be a good file name for this.
It works surprisingly well.
Re: Ask HN: What are you using to parse PDFs for RAG?
#64If this is for anything slightly commercial related you are probably going to have the best luck using Textract/Document Intelligence/Document AI. Nothing else listed in the comments is as accurate, especially when trying to extract forms, tables and text. Multi-modal will take care of your the images. The combination of those two will get you a great representation of the PDF.
Opensource tools work and can be extremely powerful but you 1) won't have images and 2) your workflows will break if you are not building it for a specific pdf template.
Re: Ask HN: What are you using to parse PDFs for RAG?
#65I am surprised nobody has mentioned it yet. If this is for anything slightly commercial related you are probably going to have the best luck using Textract/Document Intelligence/Document AI. Nothing else listed in the comments is as accurate, especially when trying to extract forms, tables and text. Multi-modal will take care of your the images. The combination of those two will get you a great representation of the…
Re: Ask HN: What are you using to parse PDFs for RAG?
#66I am surprised nobody has mentioned it yet. If this is for anything slightly commercial related you are probably going to have the best luck using Textract/Document Intelligence/Document AI. Nothing else listed in the comments is as accurate, especially when trying to extract forms, tables and text. Multi-modal will take care of your the images. The combination of those two will get you a great representation of the…
OCR itself isn't the issue; most open-source models handle that adequately. The problem lies in the lack of comprehensive features:
- Identification of chapters and headings
- Segmentation of headers and footers with an easy way to filter them out
- Handling of images
- Correctly processing two-column or other non-standard layouts
- Avoiding out-of-memory (OOM) errors, which, while not a flaw of the open-source software itself, is a common and frustrating issue
- Transcription of tables and forms, which exists in open-source models but isn't as effective
These ergonomic features are where the open-source solutions fall short.
Re: Ask HN: What are you using to parse PDFs for RAG?
#67Apache Tika Server is very easy to set up - it can be configured to use tesseract for OCR.
I parsed a PDF and when looking at the output, I noticed 'united stotes of america' was in the text. Didn't make any sense... Digging further, I saw that it had also parsed the images in the PDF, and one of them was some govt logo with bad artifacting. It did indeed read more like 'stotes' than 'states'.
Edit: That said, the OP asked about tables. I haven't tested any table stuff with tika (not something I need right now). Is the tika table support any good? Does it even exist? Seems like it might not really matter for many tika use cases (but I might be missing something obvious!)
Re: Ask HN: What are you using to parse PDFs for RAG?
#68I am surprised nobody has mentioned it yet. If this is for anything slightly commercial related you are probably going to have the best luck using Textract/Document Intelligence/Document AI. Nothing else listed in the comments is as accurate, especially when trying to extract forms, tables and text. Multi-modal will take care of your the images. The combination of those two will get you a great representation of the…
Key thing is it labels titles, headers, sections, etc. This way you can stuff headers into the child chunks for much better RAG.
Re: Ask HN: What are you using to parse PDFs for RAG?
#69You can start to look at pdftotext -layout and pandoc maybe. Personally I hope a day publishers start learning about the value of data and their representations so they decide to embed them like a *sv file attached to a pdf where the tabular data are immediately available, a .gp and alike file for graphs etc. Essentially the concept of embedding pdf "sources" as an attachment. In LaTeX it's easy to attach the LaTeX i…
Re: Ask HN: What are you using to parse PDFs for RAG?
#70My apps are native Mac apps [0] [1] so naturally I use the native SDK for that. Apple provides PDFKit framework to work with PDFs and it works really well. For scanned documents, I use the Vision framework to OCR the content. Some additional content cleaning is still required but overall I don’t need any other third-party libraries. [0]: https://boltai.com [1]: https://pdfpals.com
1. Reader mode, copy all text.
2. Prompt ChatGPT 4o:
Which headline or sentence structures in the following web page copy suggest a non-native English speaker, and how should each incorrect phrase be fixed for most native-sounding American English? Omit testimonials written by others, just focus on the marketing copy and faq, include reasons for revision.
3. Response:
Here are refined sentences focused on the marketing copy and FAQs:
Original: "From blog outlines, to highly technical content."
- Punctuation: "From blog outlines to highly technical content."
Original: "Natively intergrated with your favorite apps."
- Spelling: "Natively integrated with your favorite apps."
Original: "All costs are estimated, please refer to your OpenAI dashboard for the most accurate cost of your API key."
- Structure: "All costs are estimates. Please refer to your OpenAI dashboard for the most accurate pricing for your API key."
Original: "How does license work?"
- Non-native indicator: "How does the license work?"
Original: "The ChatGPT Plus subscription is separate and managed by OpenAI, it does not provide an API key that you can use with BoltAI."
- Punctuation: "The ChatGPT Plus subscription is separate and managed by OpenAI; it does not provide an API key for BoltAI."
Original: "Do you offer team plan license?"
- Non-native indicator: "Do you offer a team plan license?"
Original: "Absolutely. If for any reason you're not satisfied with your purchase, you can request a refund within 30 days of purchase."
- Fluency: "Absolutely. If you're not satisfied with your purchase for any reason, you can request a refund within 30 days."
These edits aim to make the text sound more natural and fluent in American English, improving clarity and coherence.