Case study / Document workflow
Research AI
A retrieval and citation-oriented document workflow with human-readable output.
Overview
What the system is
Research AI uses autonomous agents to read uploaded PDFs, summarize them, and answer questions with page-level citations — combining a document-processing pipeline with a RAG pipeline over pgvector.
Problem
The constraint that shaped it
Read uploaded PDFs and answer questions with grounded, page-level citations.
Capabilities
What it does
- 01PDF agent pipelineParses, smart-chunks, embeds, indexes, and summarizes any uploaded PDF automatically.
- 02Cited answersRAG over pgvector retrieves top-k chunks and streams answers with page-level citations.
- 03Graceful degradationA multi-model fallback chain keeps the pipeline alive when a model is rate-limited.
- 04Row-level isolationSupabase RLS isolates every user's documents and vectors at the database level.
- 05ObservabilityLangfuse traces LLM calls for latency and cost; structured JSON logging in production.
Engineering
Decisions on record
- Vector DB
- Supabase pgvector — avoids an extra service and lets RLS cover vectors too.
- LLM
- Google Gemini Flash Lite with an automatic fallback chain to stay within free-tier limits.
- Chunking
- Per-page + recursive splitting to preserve accurate page citations.
- Streaming
- Server-Sent Events for simpler serverless compatibility.
- Testing
- Vitest unit tests and Playwright E2E in a GitHub Actions pipeline.