MAMATHA EPILI / ENGINEERING & AI
Selected work

AI platform2026Team practice

Grounded

Retrieval-grounded answers that cite every claim

Stack

Frontend
  • React 18 + Vite reader panel
  • Angular 18 ingestion admin
  • TypeScript
  • Citation-aware answer rendering
Backend & Data
  • Supabase
  • PostgreSQL
  • Similarity search over stored embeddings
  • Deno Edge Functions
  • Row-level security
  • Server-held model credentials

How it works

Flowchart: Documents enter through the admin: extracted, chunked with overlap, embedded and stored in the vector knowledge base under row-level security. A reader’s question — or the caption of an attached image — is embedded and matched through one similarity function, and generation is constrained to the numbered passages it returns, so every claim carries a citation and an ungrounded answer cannot be produced.NoYesAdmin uploads document86.5Angular 18 adminExtract & chunk86.5with overlapEmbed chunksVector knowledgebase87.5Supabase Postgres ·RLSReader asks208.5React 18 reader panelImage attached?Caption the image330.5caption drives retrievalEmbed the queryMatch function202.5one similarity query ·Edge FunctionGenerate from passages208.5numbered, nothing elseCited answer202.5every claim references apassage
Documents enter through the admin: extracted, chunked with overlap, embedded and stored in the vector knowledge base under row-level security. A reader’s question — or the caption of an attached image — is embedded and matched through one similarity function, and generation is constrained to the numbered passages it returns, so every claim carries a citation and an ungrounded answer cannot be produced.

Problem

Document Q&A that answers from a model's memory can't be trusted in a certification-learning business. Answers had to come only from curated source content, with citations a reader can check — and ingestion had to be manageable through an admin surface, not a deploy.

What I built

  • A monorepo split by audience: a reader panel, a login-gated ingestion admin, and one backend serving both.
  • An ingestion pipeline: text extraction, chunking with overlap, and embedding into a vector knowledge base through the admin panel.
  • Retrieval through a single matching function, so the query path has one place to tune and one place to audit.
  • Generation constrained to numbered retrieved passages, with every claim carrying its citation.
  • Multimodal grounding end to end: image captions drive retrieval while the image itself travels as an inline part.

Technical decisions & trade-offs

  • Embedding and retrieval sit behind the database layer rather than in the client, so the ingestion format and the query path can change without touching either frontend.
  • The model key lives in Edge Function secrets, so no model call ever originates in a client bundle.
  • Row-level security grants anonymous read and admin-only write, and the service-role decision lives in one auditable module rather than smeared across handlers.
  • Grounding is enforced structurally: the model only ever sees retrieved passages, so ungrounded answers cannot happen rather than being discouraged.
  • Two frontends over one backend instead of one app with role switches, so the reader surface stays anonymous and cacheable.

Challenges solved

  • Chunk-boundary tuning: enough overlap to keep answers coherent across boundaries, without bloating the context sent to the model.
  • Multimodal grounding — captions retrievable as text while the source image rides along inline, so citations stay meaningful for figures.

Outcome

In production. Every sentence traces to a cited passage and ungrounded output is structurally impossible. The pattern became the reference architecture for retrieval work on the team.

Permalink: https://www.mamathaepili.com/projects/grounded