Live data from Hacker News

Parsing PDFs (and more) in Elixir using Rust

chriis.dev

11–18 of 18 posts

Re: Parsing PDFs (and more) in Elixir using Rust

#13
post #4

I've been thinking a lot about how to accomplish various RAG things in Elixir (for LLM applications). PDF is one of the missing pieces, so glad to see work here. The really tricky part is not just parsing out the text (you can just call the pdftotext unix command line utility for that), but accurately pulling out things like complex tables, etc in a way that could be chunked/post processed in a useful way. I'd love t…

Maybe just using pdftohtml instead of pdftotext.

Re: Parsing PDFs (and more) in Elixir using Rust

#14
post #4

I've been thinking a lot about how to accomplish various RAG things in Elixir (for LLM applications). PDF is one of the missing pieces, so glad to see work here. The really tricky part is not just parsing out the text (you can just call the pdftotext unix command line utility for that), but accurately pulling out things like complex tables, etc in a way that could be chunked/post processed in a useful way. I'd love t…

Maybe just using pdftohtml instead of pdftotext.

I experimented with it, it generates way too much noise. Cool utility, though!

Re: Parsing PDFs (and more) in Elixir using Rust

#15
post #4

I've been thinking a lot about how to accomplish various RAG things in Elixir (for LLM applications). PDF is one of the missing pieces, so glad to see work here. The really tricky part is not just parsing out the text (you can just call the pdftotext unix command line utility for that), but accurately pulling out things like complex tables, etc in a way that could be chunked/post processed in a useful way. I'd love t…

For instace Llamaparse( https://docs.llamaindex.ai/en/stable/llama_cloud/llama_parse... )uses LLMs for pdf text extraction, but the problem is hallucination. e.g > https://github.com/run-llama/llama_parse/issues/420 There is also LLMWhisperer that preserves the layout(tables, checkboxes, forms)and hence the context. https://pg.llmwhisperer.unstract.com/

Is this open source? Is it slow Python? That's where I'm stuck.

Re: Parsing PDFs (and more) in Elixir using Rust

#16
The Achilles heel of the BEAM is that if it crashes in native code then it has no way to recover and its much vaunted robustness goes out the window. So writing native hooks in Rust makes it a bit harder to crash the whole VM.

On the plus side it makes IPC pretty straightforward, so you can move the processes that need the native code (NIFs) to a separate VM if you’re feeling paranoid.

Re: Parsing PDFs (and more) in Elixir using Rust

#17
post #16

The Achilles heel of the BEAM is that if it crashes in native code then it has no way to recover and its much vaunted robustness goes out the window. So writing native hooks in Rust makes it a bit harder to crash the whole VM. On the plus side it makes IPC pretty straightforward, so you can move the processes that need the native code (NIFs) to a separate VM if you’re feeling paranoid.

Rustler actually wraps the NIF and passes the exception back to the caller

> The library provides facilities for generating the boilerplate for interacting with the BEAM, handles encoding and decoding of Erlang terms, and catches rust panics before they unwind into C.

https://github.com/rusterlium/rustler

Re: Parsing PDFs (and more) in Elixir using Rust

#18

Earlier quoted context omitted.

For instace Llamaparse( https://docs.llamaindex.ai/en/stable/llama_cloud/llama_parse... )uses LLMs for pdf text extraction, but the problem is hallucination. e.g > https://github.com/run-llama/llama_parse/issues/420 There is also LLMWhisperer that preserves the layout(tables, checkboxes, forms)and hence the context. https://pg.llmwhisperer.unstract.com/

Is this open source? Is it slow Python? That's where I'm stuck.

This is not open-source. It has high accuracy and it is faster too. All you need is to point your documents to the API.
Post reply on HN