rga, aka ripgrep-all, is my go-to for this. I suppose grep is a form of AI -- or, at least, an advanced intelligence that's wiser than it looks. ;) https://github.com/phiresky/ripgrep-all
Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
41–50 of 92 posts
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#42Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#43You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.
I found that grep actually outperformed vector search for many queries. The only thing I was missing was when I didn't know how exactly to phrase something (the exact keyword to use). Do keyword search systems have workarounds for this? My own idea was for each keyword to generate a list of neighbor keywords in semantic space. I figured with such a dataset, I'd get something approximating vector search for free. I ma…
I think that's the only things GUI (or TUI) directories have over CLI. I remember having Wikipedia locally (english texts, back in 2010) and the portals were surprisingly useful. They act like the semantic space in case you can't find an article for your exact word. So Literature > Fiction > Fantasy > Epic Fantasy will probably land you somewhere close to "The Lord of The Rings".
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#44You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.
I found that grep actually outperformed vector search for many queries. The only thing I was missing was when I didn't know how exactly to phrase something (the exact keyword to use). Do keyword search systems have workarounds for this? My own idea was for each keyword to generate a list of neighbor keywords in semantic space. I figured with such a dataset, I'd get something approximating vector search for free. I ma…
Vector search is amazing for using layman concepts.
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#45You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.
I found that grep actually outperformed vector search for many queries. The only thing I was missing was when I didn't know how exactly to phrase something (the exact keyword to use). Do keyword search systems have workarounds for this? My own idea was for each keyword to generate a list of neighbor keywords in semantic space. I figured with such a dataset, I'd get something approximating vector search for free. I ma…
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#46There is a 20 min read on why parsing PDFs is hell: https://unstract.com/blog/pdf-hell-and-practical-rag-applica...
To parse PDFs for RAG applications, you'll need tools like LLMwhisperer[1] or unstructured.io[2].
Now back to your problem:
This solution might be an overkill for your requirement, but you can try the following:
To set things up quickly, try Unstract[3], an open-source document processing tool. You can set this up and bring your own LLM models; it also supports local models. It has a GUI to write prompts to get insights from your documents.[4]
[1] https://unstract.com/llmwhisperer/ [2] https://unstructured.io/ [3] https://github.com/Zipstack/unstract [4] https://github.com/Zipstack/unstract/blob/main/docs/assets/p...
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#47https://andrejusb.blogspot.com/2024/03/optimizing-receipt-pr...
But I suggest that you just skip that and use gpt-4o. They aren't actually going to steal your data.
Sort through it to find anything with a credit card number or anything ahead time.
Or you could look into InternVL..
Or a combination of PaddleOCR first and then use a strong LLM via API, like gpt-4o or llama3 70b via together.ai
If you truly must do it locally, then if you have two 3090s or 4090s it might work out. Otherwise it the LLMs may not be smart enough to give good results.
Leaving out the details of your hardware makes it impossible to give good advice about running locally. Other than, it's not really necessary.
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#48RAG cli from llamaindex, allow you to do it 100% locally when used with ollama or llamacpp instead of OpenAI. https://docs.llamaindex.ai/en/stable/getting_started/starter...
Does the llamaindex PDF indexer correctly deal with multi-column PDFs? Most I've seen don't, and you get very odd results because of this.
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#49The primary challenge is not just about harnessing AI for search; it's about preparing complex documents of various formats, structures, designs, scans, multi-layout tables, and even poorly captured images for LLM consumption. This is a crucial issue. There is a 20 min read on why parsing PDFs is hell: https://unstract.com/blog/pdf-hell-and-practical-rag-applica... To parse PDFs for RAG applications, you'll need tool…
Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?
#50If you want to run locally you can look into this https://github.com/PaddlePaddle/PaddleOCR https://andrejusb.blogspot.com/2024/03/optimizing-receipt-pr... But I suggest that you just skip that and use gpt-4o. They aren't actually going to steal your data. Sort through it to find anything with a credit card number or anything ahead time. Or you could look into InternVL.. Or a combination of PaddleOCR first and then u…
Why do you have this confidence? Is it based on reading their TOS, and assuming they'll follow it?