RAG platform

I inherited a retrieval-augmented generation platform and made it faster, more complete and harder to break.

Python, FastAPI, Postgres, pgvector, AWS

What it does

Teams upload documents and connect external sources like a Zendesk knowledge base and a master content library. The platform ingests them, splits them into chunks, indexes them for AI search, and answers questions with cited sources.

What I inherited

Other engineers built the core before I took it on. As the knowledge bases grew, search slowed down, some documents never became searchable, and failures showed up as empty results instead of clear errors.

What I did

  • Speed. Moved search onto an approximate vector index, including searches limited to what a user is allowed to see. Before trusting it, I compared its results against exact search.
  • Zendesk knowledge base. Built the Zendesk integration on my own, bringing 800 help-centre articles and their attachments into AI search. When coverage fell short, I compared what was in storage against what the database said was indexed, found every missing file, and fixed the root cause.
  • Master content library. Built the nightly sync for a 4.5K-document content library. It runs in batches of 400, resumes where it left off, and stops calling the source API after repeated failures instead of hammering it.
  • Reliability. A document that fails is marked failed and retried on the same record, duplicates are caught by content and metadata, and a failed re-index keeps the old version searchable.
  • Answers. Answers cite their sources inline, skip citations when there’s no real answer, and return a clear error instead of an empty result when something fails. Users can also get answers in any of 90 languages.
  • Access. Added user-level access rules to search filtering.
  • Operations. Made models load from a cache at startup instead of downloading at runtime.
  • AI tools. Built 3 MCP tools that let AI assistants file compliance requests through existing backend services.
  • OCR. Scanned PDFs with e-signature stamps are now detected and sent to OCR automatically.

Result

  • Median search time went from 8.2 s to 0.6 s in production, 13 times faster, across 509K chunks. The 95th percentile went from 8.5 s to 0.9 s.
  • The top 5 results matched exact search in 25 of 25 runs.
  • The Zendesk knowledge base of 800 articles went from 79% to 99.7% indexed.
  • The 4.5K-document master content library stays in sync every night.
  • More than 180 commits over six months.