Document platform
A RAG platform that plans its search before it searches.
- Role
- Design and build (internship)
- Year
- 2025-2026
- Stack
- Gemini API
- RAG
- Vector search
- Google SSO
- TypeScript
- Status
- Private, behind login
An internal platform I built during my internship for an organisation in the nature and environmental sector: staff ask questions about their organisation’s documents and get answers with sources. It’s behind a login, so here’s the architecture instead of screenshots.
The problem
Years of documents on shared drives, findable only by whoever remembered where things were. A chatbot on top doesn’t fix that. When it finds nothing, it makes something up.
A month lost to n8n
My supervisor suggested n8n, and I said yes. The first version worked within a week. Then every real question needed another branch, and the logic ended up as untyped JavaScript inside Code nodes. After a month I stopped, explained why, and rebuilt it in TypeScript. That took less time than the month I’d lost.
Two models instead of one
Normal RAG turns a question into one search, which breaks on compound questions. So the first model only makes a plan: what to look for, in what order. The second one runs that plan and answers with a source per claim. One extra model call per question, and worth it: people would rather wait a second than get an answer they can’t trust.
The hard part
Answers were still often wrong, and the cause was ingestion. Fixed-length chunks cut sentences in half, and repeated page footers matched questions better than the real content. Tweaking chunk sizes didn’t help. Splitting on headings, stripping repeated lines and prefixing every chunk with its document title did.
Decisions
- Gemini, because the organisation already ran on Google Workspace. The vendor lock-in that comes with it is contained behind one module.
- The system is allowed to refuse. Below a similarity threshold it says it found nothing and shows the documents that came closest.
- Access is flat: everyone logged in sees every document. Fine for v1, but per-document permissions belong at retrieval.
What I’d do differently
Test a tool for two days with the three hardest questions before giving it a month. And write the test questions on day one, not halfway through.