Most active commenters
  • Tammilore(7)
  • (5)
  • emmanueloga_(4)
  • sidmo(3)

168 points Tammilore | 63 comments | | HN request time: 1.52s | source | bottom

Documind is an open-source tool that turns documents into structured data using AI.

What it does:

- Extracts specific data from PDFs based on your custom schema - Returns clean, structured JSON that's ready to use - Works with just a PDF link + your schema definition

Just run npm install documind to get started.

1. bob778 ◴[] No.42171806[source]
From just reading the README, the example is not valid JSON. Is that intentional?

Otherwise it seems like a prompt building tool, or am I missing something here?

replies(2): >>42171913 #>>42172158 #
2. rkuodys ◴[] No.42171839[source]
Just this weekend was solving similar problem.

What I've noticed, that on scanned documents, where stamp-text and handwriting is just as important as printed text, Gemini was way better compared to chat gpt.

Of course, my prompts might have been an issue, but gemini with very brief and generic queries made significantly better results.

3. inexcf ◴[] No.42171899[source]
Got excited about an open-source tool doing this.

Alas, i am let down. It is an open-source tool creating the prompt for the OpenAI API and i can't go and send customer data to them.

I'm aware of https://github.com/clovaai/donut so i hoped this would be more like that.

replies(5): >>42171944 #>>42171963 #>>42172184 #>>42172234 #>>42195901 #
4. assanineass ◴[] No.42171913[source]
Oof you’re right LOL
5. _joel ◴[] No.42171944[source]
You can self host OpenAPI compatible models with lmstudio and the like. I've used it with https://anythingllm.com/
6. danbruc ◴[] No.42171959[source]
With such a system, how do you ensure that the extracted data matches the data in the source document? Run the process several times and check that the results are identical? Can it reject inputs for manual processing? Or is it intended to be always checked manually? How good is it, how many errors does it make, say per million extracted values?
replies(1): >>42172472 #
7. turblety ◴[] No.42171963[source]
You might be able to use Ollama, which has a OpenAI compatible API.
replies(1): >>42172054 #
8. khaki54 ◴[] No.42172027[source]
Not sure I would want something non-deterministic in my data pipeline. Maybe if it used GenAI to _develop a ruleset_ that could then be deployed, it would be more practical.
9. Zambyte ◴[] No.42172054{3}[source]
Not without chaning the code (should be easy though)

https://github.com/DocumindHQ/documind/blob/d91121739df03867...

10. fredtalty5 ◴[] No.42172058[source]
Documind: Open-Source AI for Document Data Extraction

If you're dealing with unstructured data trapped in PDFs, Documind might be the tool you’ve been waiting for. It’s an open-source solution that simplifies the process of turning documents into clean, structured JSON data with the power of AI.

Key Features: 1. Customizable Data Extraction Define your own schema to extract exactly the information you need from PDFs—no unnecessary clutter.

2. Simple Input, Clean Output Just provide a PDF link and your schema definition, and it returns structured JSON data, ready to integrate into your workflows.

3. Developer-Friendly With a simple setup (`npm install documind`), you can get started right away and start automating tedious document processing tasks.

Whether you’re automating invoice processing, handling contracts, or working with any document-heavy workflows, Documind offers a lightweight, accessible solution. And since it’s open-source, you can customize it further to suit your specific needs.

Would love to hear if others in the community have tried it—how does it stack up for your use cases?

11. avereveard ◴[] No.42172088[source]
> an interesting open source project

enthusiastically setting up a lounge chair

> OPENAI_API_KEY=your_openai_api_key

carrying it back apathetically

replies(2): >>42172205 #>>42172807 #
12. gibsonf1 ◴[] No.42172102[source]
I'm not sure having statistics with fabrication try to extract text from PDF's would result in any mission-critical reliable data?
13. Tammilore ◴[] No.42172158[source]
Thanks for pointing this out. This was an error on my part.

I see someone opened an issue for it so will fix now.

14. Tammilore ◴[] No.42172184[source]
Hi. I totally get the concern about sending data to OpenAI. Right now, Documind uses OpenAI's API just so people could quickly get started and see what it is like, but I’m open to adding options and contributions that would be better for privacy.
replies(1): >>42188570 #
15. Tammilore ◴[] No.42172205[source]
Thanks for the laugh and your feedback! I know that depending on an OpenAI isn't ideal for everyone. I'm considering ways to make it more self-contained in the future, so it’s great to hear what users are looking for.
replies(1): >>42175974 #
16. eichi ◴[] No.42172214[source]

  const systemPrompt = `
    Convert the following PDF page to markdown.
    Return only the markdown with no explanation text. Do not include deliminators like '''markdown.
    You must include all information on the page. Do not exclude headers, footers, or subtext.
  `;
replies(1): >>42172227 #
17. ◴[] No.42172227[source]
18. ◴[] No.42172234[source]
19. thor-rodrigues ◴[] No.42172239[source]
Very nice tool! Just last week, I was working on extracting information from PDFs for an automation flow I’m building. I used Unstructured (https://unstructured.io/), which supports multiple file types, not just PDFs.

However, my main issue is that I need to work with confidential client data that cannot be uploaded to a third party. Setting up the open-source, locally hosted version of Unstructured was quite cumbersome due to the numerous additional packages and installation steps required.

While I’m open to the idea of parsing content with an LLM that has vision capabilities, data safety and confidentiality are critical for many applications. I think your project would go from good to great if it would be possible to connect to Ollama and run locally,

That said, this is an excellent application! I can definitely see myself using it in other projects that don’t demand such stringent data confidentiality.”

replies(1): >>42172303 #
20. Tammilore ◴[] No.42172303[source]
Thank you, I appreciate the feedback! I understand people wanting data confidentiality and I'm considering connecting Ollama for future updates!
21. glorpsicle ◴[] No.42172472[source]
Perhaps there's still value in the documents being transformed by this tool and someone reviewing them manually, but obviously the real value would be in reducing manual review. I don't think there's a world–for now–in which this manual review can be completely eliminated.

However, if you process, say, 1 million documents, you could sample and review a small percentage of them manually (a power calculation would help here). Assuming your random sample models the "distribution" (which may be tough to define/summarize) of the 1 million documents, you could then extrapolate your accuracy onto the larger set of documents without having to review each and every one.

replies(1): >>42174980 #
22. ◴[] No.42172807[source]
23. asjfkdlf ◴[] No.42173400[source]
I am looking for a similar service that turns any document (PNG, PDf, DocX) into JSON (preserving the field relationships). I tried with ChatGPT, but hallucinations are common. Does anything exist?
replies(2): >>42173587 #>>42173893 #
24. omk ◴[] No.42173587[source]
This is also using OpenAI's GPT model. So the same hallucinations are probable here for PDFs.
25. hirezeeshan ◴[] No.42173661[source]
That's a valid problem you are solving. I had similar usecase that I solved using PDF[dot]co
26. azinman2 ◴[] No.42173795[source]
Looking at the source it seems this is just a thin wrapper over OpenAI. Am I missing something?
27. emmanueloga_ ◴[] No.42173837[source]
From the source, Documind appears to:

1) Install tools like Ghostscript, GraphicsMagick, and LibreOffice with a JS script. 2) Convert document pages to Base64 PNGs and send them to OpenAI for data extraction. 3) Use Supabase for unclear reasons.

Some issues with this approach:

* OpenAI may retain and use your data for training, raising privacy concerns [1].

* Dependencies should be managed with Docker or package managers like Nix or Pixi, which are more robust. Example: a tool like Parsr [2] provides a Dockerized pdf-to-json solution, complete with OCR support and an HTTP api.

* GPT-4 vision seems like a costly, error-prone, and unreliable solution, not really suited for extracting data from sensitive docs like invoices, without review.

* Traditional methods (PDF parsers with OCR support) are cheaper, more reliable, and avoid retention risks for this particular use case. Although these tools do require some plumbing... probably LLMs can really help with that!

While there are plenty of tools for structured data extraction, I think there’s still room for a streamlined, all-in-one solution. This gap likely explains the abundance of closed-source commercial options tackling this very challenge.

---

1: https://platform.openai.com/docs/models#how-we-use-your-data

2: https://github.com/axa-group/Parsr

replies(5): >>42175186 #>>42176460 #>>42176836 #>>42178185 #>>42195512 #
28. cccybernetic ◴[] No.42173893[source]
I built a drag-and-drop document converter that extracts text into custom columns (for CSV) or keys (for JSON). You can schedule it to run at certain times and update a database as well.

I haven't had issues with hallucinations. If you're interested, my email is in my bio.

29. infecto ◴[] No.42174595[source]
Multimodal LLM are not the way to do this for a business workflow yet.

In my experience your much better of starting with a Azure Doc Intelligence or AWS Textract to first get the structure of the document (PDF). These tools are incredibly robust and do a great job with most of the common cases you can throw at it. From there you can use an LLM to interrogate and structure the data to your hearts delight.

replies(2): >>42176035 #>>42176122 #
30. constantinum ◴[] No.42174779[source]
Reading from the comments, some of the common questions regarding document extraction are:

* Run locally or on premise for security/privacy reasons

* Support multiple LLMs and vector DBs - plug and play

* Support customisable schemas

* Method to check/confirm accuracy with source

* Cron jobs for automation

There is Unstract that solves the above requirements.

https://github.com/Zipstack/unstract

31. danbruc ◴[] No.42174980{3}[source]
You can sample the result to determine the error rate, but if you find an unacceptable level of errors, then you still have to review everything manually. On the other hand, if you use traditional techniques, pattern matching with regular expressions and things like that, then you can probably get pretty close to perfection for those cases where your patterns match and you can just reject the rest for manual processing. Maybe you could ask a language model to compare the source document and the extracted data and to indicate whether there are errors, but I am not sure if that would help, maybe what tripped up the extraction would also trip up the result evaluation.
32. ◴[] No.42175186[source]
33. vr46 ◴[] No.42175881[source]
I’ll have to test this against my local Python pipeline which does all this without an LLM in attendance. There are a ton of existing Python libraries which have been doing this for a long time, so let’s take a look..
replies(1): >>42176786 #
34. avereveard ◴[] No.42175974{3}[source]
litellm would be a start, then you just pass in a model string that includes the provider, and can default on openai gpts, that removes most of the effort in adapting stuff both from you and other users.
35. IndieCoder ◴[] No.42176035[source]
Plus one, using the exact setup to make it scale. If Azure Doc Intelligence gets too expensive, VLMs also work great
replies(1): >>42177063 #
36. disgruntledphd2 ◴[] No.42176122[source]
> AWS Textract to first get the structure of the document (PDF). These tools are incredibly robust and do a great job with most of the common cases you can throw at it.

Do they work for Bills of Lading yet? When I tested a sample of these bills a few years back (2022 I think), the results were not good at all. But I honestly wouldn't be surprised if they'd massively improved lately.

replies(1): >>42178301 #
37. groby_b ◴[] No.42176460[source]
That's not what [1] says, though? Quoth: "As of March 1, 2023, data sent to the OpenAI API will not be used to train or improve OpenAI models (unless you explicitly opt-in to share data with us, such as by providing feedback in the Playground). "

"Traditional methods (PDF parsers with OCR support) are cheaper, more reliable"

Not sure on the reliability - the ones I'm using all fail at structured data. You want a table extracted from a PDF, LLMs are your friend. (Recommendations welcome)

replies(2): >>42176810 #>>42179086 #
38. thegabriele ◴[] No.42176786[source]
Care to share the best ones for some use cases? Thanks
replies(1): >>42177301 #
39. niklasd ◴[] No.42176810{3}[source]
We found that for extracting tables, OpenAIs LLMs aren't great. What is working well for us is Docling (https://github.com/DS4SD/docling/)
replies(2): >>42178239 #>>42180258 #
40. brianjking ◴[] No.42176836[source]
OpenAI isn't retaining your details sent via the API for training details. Stopp.
41. vinothgopi ◴[] No.42177063{3}[source]
What is a VLM?
replies(1): >>42177860 #
42. vr46 ◴[] No.42177301{3}[source]
MinerU

PDFQuery

PyMuPDF (having more success with older versions, right now)

43. saharhash ◴[] No.42177860{4}[source]
Vision Language Model like Qwen VL https://github.com/QwenLM/Qwen2-VL or CoPali https://huggingface.co/blog/manu/colpali
replies(1): >>42195886 #
44. themanmaran ◴[] No.42178185[source]
Disappointed to see this is an exact rip of our open source tool zerox [1]. With no attribution. They also took the MIT License and changed it out for an AGPL.

If you inspect the source code, it's a verbatim copy. They literally just renamed the ZeroxOutput to DocumindOutput [2][3]

[1] https://github.com/getomni-ai/zerox

[2] https://github.com/DocumindHQ/documind/blob/main/core/src/ty...

[3] https://github.com/getomni-ai/zerox/blob/main/node-zerox/src...

replies(3): >>42178533 #>>42178736 #>>42200734 #
45. soci ◴[] No.42178239{4}[source]
agreed, extracting tables in pdfs using any of the available openAI models has been a waste of prompting time here too.
46. infecto ◴[] No.42178301{3}[source]
Have not used in on your docs but I can say that it definitely works well with forms and forms with tables like a Bill of Lading. It costs extra but you need to turn on table extract (at least in AWS). You then can get a markdown representation of that page include table, you can of course pull out the table itself but unless its standardized you will need the middleman LLM figuring out the exact data/structure you are looking for.
replies(1): >>42193210 #
47. vunderba ◴[] No.42178522[source]
OP, you've been accused of literally ripping off somebody's more popular repository and posing it as your own.

https://news.ycombinator.com/item?id=42178413

You may wanna get ahead of this because the evidence is fairly damning. Failing to even give credit to the original project is a pretty gross move.

replies(1): >>42178774 #
48. alchemist1e9 ◴[] No.42178533{3}[source]
Are there any reputation mechanisms or github flagging systems to alert users to such scams?

It’s a pretty unethical behavior if what you describe is the full story and as a user of many open source projects how can one be aware of this type of behavior?

49. Tammilore ◴[] No.42178736{3}[source]
Hello. I apologize that it came across this way. This was not the intention. Zerox was definitely used and I made sure to copy and include the MIT license exactly as it was inside the part of the code that uses Zerox.

If there's any additional thing I can do, please let me know so I would make all amendements immediately.

replies(1): >>42200920 #
50. Tammilore ◴[] No.42178774[source]
Hi. This was definitely not the intention.

I made sure to copy and past the MIT license in Zerox exactly as it was into the folder of the code that uses it. I also included it in the main license file as well. If there's anything I could do to make corrections please let me know so I'd change that ASAP.

51. emmanueloga_ ◴[] No.42179086{3}[source]
> That's not what [1] says, though?

Documind is using https://api.openai.com/v1/chat/completions, check the docs at the end of the long API table [1]:

> * Chat Completions:

> Image inputs via the gpt-4o, gpt-4o-mini, chatgpt-4o-latest, or gpt-4-turbo models (or previously gpt-4-vision-preview) are not eligible for zero retention."

--

1: https://platform.openai.com/docs/models#how-we-use-your-data

replies(1): >>42188577 #
52. emmanueloga_ ◴[] No.42180258{4}[source]
Haven't seen Docling before, it looks great! Thanks for sharing.
53. ◴[] No.42186391[source]
54. inexcf ◴[] No.42188570{3}[source]
That sounds great.
55. groby_b ◴[] No.42188577{4}[source]
Thanks for pointing there!

It's still not used for training, though, and the retention period is 30 days. It's... a livable compromise for some(many) use cases.

I kind of get the abuse policy reason for image inputs. It makes sense for multi-turn conversations to require a 1h audio retention, too. I'm just incredibly puzzled why schemas for structured outputs aren't eligible for zero-retention.

replies(1): >>42190973 #
56. emmanueloga_ ◴[] No.42190973{5}[source]
Gotcha, from what I could find online I think you are right. I was conflating data not under zero-retention-policy with data-for-training.
57. disgruntledphd2 ◴[] No.42193210{4}[source]
Huh, interesting. I'll have to try again next time I need to parse stuff like this.
58. sidmo ◴[] No.42195512[source]
If you are looking for the latest/greatest in file processing i'd recommend checking out vision language models. They generate embeddings of the images themselves (as a collection of patches) and you can see query matching displayed as a heatmap over the document. Picks up text that OCR misses. My company DataFog has an open-source demo if you want to try it out: https://github.com/DataFog/vlm-api

If you're looking for an all-in-one solution, little plug for our new platform that does the above and also allows you to create custom 'patterns' that get picked up via semantic search. Uses open-source models by default, can deploy into your internal network. www.datafog.ai. In beta now and onboarding manually. Shoot me an email if you'd like to learn more!

59. sidmo ◴[] No.42195886{5}[source]
VLMs are cool - they generate embeddings of the images themselves (as a collection of patches) and you can see query matching displayed as a heatmap over the document. Picks up text that OCR misses. Here's an open-source API demo I built if you want to try it out: https://github.com/DataFog/vlm-api
60. sidmo ◴[] No.42195901[source]
I'd recommend checking out vision language models. They generate embeddings of the images themselves (as a collection of patches) and you can see query matching displayed as a heatmap over the document. Picks up text that OCR misses. I built a simple API over it if you want to try it out: https://github.com/DataFog/vlm-api
61. dontdoxxme ◴[] No.42200734{3}[source]
For the MIT license to make sense it needs a copyright notice, I don’t actually see one in the original license. It just says “The MIT license” but then the text below references the above copyright notice, which doesn’t exist.

I think both sides here can learn from this, copyright notices are technically not required but when some text references them it is very useful. The original author should have added one. The user of the code could also have asked about the copyright. If this were to go to court having the original license not making sense could create more questions than it should.

tl;dr: add a copyright line at the top of the file when you’re using the MIT license.

62. gmerc ◴[] No.42200920{4}[source]
You took their code, did a search and replace on the product name and you're relicensed the code AGPL?

You're going to have to delete this thing and start over man.