r/Rag 23h ago

Showcase Free SQL RAG and Lessons Learned

I have been a lawyer for 20 years. Before that, I was a LAMP stack web developer. I made web apps for small to medium sized businesses and some government working units. Tragically uncool, but PHP paid for some fine Top Ramen in law school.

I laugh that now I've made an equally uncool SQLite + PDF RAG app. But it works well for single users and small teams. I use PDF because in law you have to *correctly quote to the page, and everyone works with PDFs. It has 3 desktop apps (free on the Microsoft Store) and one optional paid SaaS tool for AI OCR and summarization.

Fact Extract Prep converts a folder tree to a flat folder of PDFs. OCR can be applied via Tesseract. Optional BYO AI corrects Tesseract if high accuracy matters. It piggybacks on the Tesseract text-to-image mapping because I ain't smart enough to figure out how to map that from scratch. Videos are converted to metadata and a frame every 10% of play time. Emails are opened and converted along with attachments, nested 5 layers. Batch jobs as needed and let it run. The amount of life this thing has given back to me and my staff...

Fact Extract Bookmarker splits big PDFs at the bookmark. If there are levels of bookmarks, you can pick the one you want to use. You can quickly page through a PDF and add bookmarks hitting the space bar. There is a cool BYO AI functionality that will add the bookmarks for you, and then you just adjust if/as needed. That took a while to get working, for me anyway.

Fact Extract Desktop is the main RAG tool. It ingests a folder of PDF files, chunks to the page, and optionally adds embeddings. Those are at the 1/2 page and full page chunking level for big ideas. SQL, thesaurus, and summaries for other searches. The app allows notes, collections, exports, cross-database searches. Exports can be text or PDF, and new PDFs can be assembled from existing pages/collections.

An MCP server in Desktop can be added by one click to Claude Desktop, OpenWork, Goose, and AnythingLLM. The MCP allows the AI to search, link directly to cited pages, export and rename pages, annotate, and save findings for future work. Databases have a global ID so they can be shared by users and the links still work. Think: Associate lawyer does discovery response review, and hands the senior lawyer a Word file with links to the Fact Extract database. The senior reviews and builds a deposition outline and exhibits. Whoot.

The SaaS reviews PDFs at the page, file, or detected document level. It does OCR with AI vision that far outperforms traditional OCR. It uses a "structure" of prompts to ask a user-defined set of questions of each chunk. The user gets that analysis as a spreadsheet and a Fact Extract Desktop database with the good OCR and the summary. On specialized topics, the summary facilitates review with an AI via the MCP. And since the MCP allows the AI to pull images as well as text, OCR or summary errors can be addressed in chat/agentic review. The SaaS accepts Fact Extract databases in lieu of PDFs. Summaries can be added or OCR reused. The price is lower since we don't have to OCR or detect documents.

You won't run a giant company or centralized app on this. But it works great for those small groups that don't need concurrent database writing access. And it's free. I only use the SaaS when I have to. Most of the time using a good AI is perfectly sufficient.

Let me say - many here build way more elegant solutions. I think this has something to add as a workhorse. I'm happy to discuss how I approached problems if anyone is interested. The database structure and structure specs are what I referred to as open.schema. They are available on the websites.

Fact Extract Desktop

https://apps.microsoft.com/detail/9mww2wn9lsvz?hl=en-US&gl=US

Fact Extract Prep

https://apps.microsoft.com/detail/9nm1vsbz26t4?hl=en-US&gl=US

Fact Extract Bookmarker

https://apps.microsoft.com/detail/9nkzp48qttf3?hl=en-US&gl=US

Tutorials

https://factextract.net/tutorials

Schema

https://factextract.net/specifications

17 Upvotes

1 comment sorted by