Apps & websites

A RAG support bot built in Postgres alone for a take-home assignment

Amaan built gaspy for a Bangalore startup's SDE assignment: ingest, chunk, embed and retrieve all inside Neon Postgres with pgvector and handwritten SQL, no Pinecone or LangChain. Below a 0.6 cosine threshold the LLM is skipped and the bot says it doesn't know. The founder never wrote back.

View on X
266likes
8reposts
197saves
9.3Kviews
Made with
Gemini Flash, Groq, pgvector, Neon
Role
Artist and software developer
Posted
Amaan@dextertwts

got an SDE assignment from a blr-based startup: build a general chatbot + RAG pipeline, configurable through an admin dashboard.

so i built gaspy
i wrapped it in a sales/CRM-style frontend so the support bot sits on something that looks like a product, not a demo.

- full RAG pipeline : ingest → chunk → embed → retrieve → generate, all in one Postgres (Neon). no Pinecone, no LangChain. retrieval is handwritten SQL using pgvector's cosine distance operator

- two-track retrieval : every query pulls the top 5 document chunks + top 3 curated Q&A pairs, merged into one prompt

- relevance gating : tested extensively and cut everything below a 0.6 cosine threshold. below that, the LLM is skipped and the bot says it doesn't know, instead of hallucinating

- model fallback : gemini flash → groq with 3 retries + exponential backoff, plus a custom SSE parser that handles partial data frames mid-stream

- full ingestion pipeline : pdf/docx/xlsx upload with MIME allowlist + size limit, text extraction via pdf2json/mammoth/xlsx, overlapping chunks so no text is lost at boundaries, parallel embedding for instant searchability

the founder ghosted me but hey i got to work with a lot of AI infra/rag pipeline stuff and now i understand it way better

View on X
Still from the video

More in Apps & websites