MODULE 03 / RETRIEVAL

RAG + 3D Chat

Chat with your docs. When the answer is a structure, render it inline in Three.js with citations pointing back to source chunks. Top-k → rerank → cite, kept stupid-simple.

pgvector + bge-rerankerStreaming SSE3D outputs deterministic from trace
INGESTIONUploadChunkerEmbeddingspgvector storeretrieveQUERYUser queryTop-kRerank (bge)LLMStreaming3D RendererThree.js · deterministic↳ typed payload
CHAT
What auth pattern does this project use?
This project uses **Clerk**. The middleware is configured in `proxy.ts` (Next.js 16 pattern), protecting `/dashboard(.*)` via `clerkMiddleware`. src/proxy.ts:12 · providers.tsx:8

Rate limited: 2 messages/hour (guest) · 50/hour (signed in)

RETRIEVAL TRACE
● top_k=8 · 23ms
● rerank → 3 chunks kept
↳ src/proxy.ts:1-22 (0.91)
↳ providers.tsx:1-18 (0.84)
↳ auth/layout.tsx:1-30 (0.71)
● gen → 412 tokens · 1.2s
● streamed · cited
3D VIEWER
RENDERED · 3D PAYLOAD v0.3

When a question implies structure — an org graph, a network, a 3D scene — the model emits a typed payload alongside the prose. The renderer is deterministic from that payload, so the same trace renders the same scene.

No image hallucination. No prompt-to-Three.js gymnastics. Just a small schema and a viewer.

RENDERED · 3D PAYLOAD v0.3