← All work

01 DepoIQ AI + Backend

Finding the one line of testimony that matters

Search for a legal research assistant where a missed passage or a misquote is worse than no answer, built on hybrid retrieval, parallel subagents and quote verification.

Role
AI Engineer
When
2026 — now
Live
depoiq.com ↗
  • FastAPI
  • PostgreSQL
  • pgvector
  • BM25
  • LLM subagents
  • AWS S3
  • GCP Cloud Run
  • BM25 + vectorstwo retrieval signals, scored 0–1 by Jev
  • Parallelsubagents cover every document
  • S3 → GCPpartner uploads processed automatically
How it works
  1. 01Questionwhole case
  2. 02Splitsubagents
  3. 03SearchBM25 + pgvector
  4. 04ScoreJev, 0–1
  5. 05Verifyquote vs. source
  6. 06Answerwith citations

The problem

DepoIQ helps legal teams work through deposition testimony. Its research assistant, Ask AI, has to answer questions like “what did the witness say about the March meeting?” across a case’s transcripts.

There are two hard parts. The first is recall. The right passage might use the exact name or exhibit number in the question, or it might paraphrase it entirely. The second is trust. In legal work, a fluent answer with a misquoted passage is worse than no answer at all.

Hybrid retrieval

Keyword search and semantic search fail in opposite ways. BM25 is excellent at exact terms like names, dates and exhibit numbers, but it misses paraphrase. Vector search (pgvector) catches meaning, but it can blur precise terms.

I built a hybrid search that runs both and merges the candidates. Each candidate then goes to Jev, a decision model that answers one question: is this document actually relevant to the query? It outputs a probability between 0 and 1, which gives two things. Results can be ranked so the most relevant testimony comes first, and documents that clearly don’t belong can be dropped before they ever reach the LLM.

Everything runs on PostgreSQL, so there’s no separate search cluster to operate.

Some questions are about the whole case, not one transcript. A single retrieval call can’t reliably cover dozens of documents. So I built subagent-driven search: the question is split across parallel LLM subagents, each responsible for its own slice of the documents. Every document gets read, and nothing is skipped because it fell outside a top-k cutoff.

Before anything reaches the user, each quoted passage is verified against its source. If a subagent quotes testimony, that text has to actually exist where it says it does.

Getting documents in

A partner needed to send depositions from their own AWS environment. I built a cross-cloud integration: they upload to S3, a Lambda hands off to GCP (Cloud Workflows orchestrating Cloud Run jobs), and status updates go back to the partner at every stage. They never have to ask “did it work?”