Ian Greenough

Founding Product Engineer
← Back to projects

AI Research Assistant

I built this as a compound AI system combining all the patterns from earlier projects into one: auth, queues, streaming, embeddings, and vector search. Users submit sources (URLs, PDFs, or plain notes) and background BullMQ workers fetch, extract, and chunk the content into 500-token segments with 50-token overlap.

Voyage AI generates 1024-dimension embeddings for each chunk, stored in PostgreSQL via pgvector. At query time the question is embedded, a cosine similarity search retrieves the top 5 chunks, and Claude generates a streaming answer with numbered citations. CitationBadge components expand inline to show the exact chunk text and a link to the source.

PDFs are stored in Cloudflare R2 with presigned URLs. Claude 3 Haiku handles metadata extraction and auto-titling while Claude 3.5 Sonnet handles chat, keeping costs down without compromising answer quality.

Technologies Used

TypeScriptNext.jsExpressPostgreSQLpgvectorRedisBullMQClaude APIVoyage AICloudflare R2