Skip to content

feat: understand questions in the library's words, Learning Paths and AI reliability - #28

Merged
im-rk merged 5 commits into
mainfrom
feature/query-understanding-learning-paths
Oct 3, 2026
Merged

im-rk merged 5 commits into
mainfrom
feature/query-understanding-learning-paths

Conversation

@im-rk

@im-rk im-rk commented Oct 3, 2026

Copy link
Copy Markdown
Member

What this is

An end-to-end audit of the live site (Oct 3), the fixes it called for, and one new feature built on the same two engines (Cloudinary transformations + one citation-grounded AI call). Spec and evidence: docs/phases/PHASE-18-query-understanding-learning-paths.md.

Audit findings → fixes

Finding (real, reproduced) Fix
"What is the bias-variance trade-off?" returned not covered against a lecture titled The Bias–Variance Trade-off. Keyword search never saw the lecturer's words Question understanding: when keyword retrieval is thin (or the question is in another script), one AI call rewrites it into the library's own vocabulary; keyword hits keep priority. The prompt now says honestly when a term isn't used and explains the related ideas with citations
Hindi questions silently dropped when a model was rate-limited Same step; the answer is now written in the asker's language (the system prompt names it)
A dead model (Gemini 429 quota, seen live) cost every request its full timeout Circuit breaker: quota/auth/overload failures skip that model for 20–60 s
A slow provider could push a request past maxDuration Whole-chain deadline shared by every attempt
"Is AI actually working?" had no answer GET /api/health?deep=1 makes one tiny real call per model
"regularization" found no moment, hiding the session about it Find now also shows Sessions about this (title, speaker, chapters)
Hindi subtitles existed for 1 of 6 sessions Backfilled the other 5 with Cloudinary explicit (data fix, no code)

New: Learning Paths (/learn, /p/[id])

A topic becomes an ordered 3–5 step micro-course across the library, edited into one Cloudinary reel. Every step is a real retrieved moment with a "why this comes next". validatePath() drops anything the model wasn't given, and returns no course rather than padding (same discipline as Ask). Stored and shareable with a Cloudinary share card. "Go deeper" under every answer opens one.

Verified on real data

  • Bias-variance question → answered honestly with 6 citations (was not_found); off-topic questions still not_found
  • Hindi → Hindi answers citing English lectures; 5-clip reel
  • "Optimizers for training neural networks" → 4 steps from 2 lecturers, 65 s reel that renders (HTTP 200)
  • A real Gemini 429 during testing: the breaker skipped the dead model and Ask kept answering

Checklist

  • pnpm lint, pnpm typecheck, pnpm test (108 passing; new: breaker, query plan, path validator, answer language)
  • migrations/006_learning_paths.sql (already applied to the shared Neon database)
  • Docs: phase 18, API, implementation plan
  • No secrets in this diff

im-rk added 5 commits October 3, 2026 09:39
A quota, auth or overload failure now skips that model for 20-60 s instead of costing every request its timeout; the whole chain shares one budget so a slow provider cannot exceed maxDuration; /api/health?deep=1 makes one real call per model.
When a question is in another script or keyword retrieval is thin, one AI call rewrites it into the vocabulary of the session and chapter titles; keyword hits keep priority. Near-miss questions get an honest answer from related ideas instead of a refusal, and non-Latin questions are answered in their own language. Replaces the translate-only step.
A topic becomes an ordered 3-5 step micro-course across the library, validated so every step is a real retrieved moment, stitched into one Cloudinary reel, stored and shareable at /p/[id] with a share card.
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pravaha Ready Ready Preview Oct 3, 2026 4:11am UTC

@im-rk
im-rk merged commit d5213b6 into main Oct 3, 2026
3 checks passed
@im-rk
im-rk deleted the feature/query-understanding-learning-paths branch October 3, 2026 04:11

This branch was successfully deployed

1 active deployment
Preview — b4d54cee Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant