Live embedding (deep dive)
You could wire embedQuery(text) with transformers.js and embed your own sentence live, on CPU, in pure TypeScript. It's a great extension — but it is deliberately not on the graded path of this course, and it's worth understanding why.
Why live embedding is ungraded here
onnxruntime-node produces slightly different float outputs on different CPU microarchitectures. A grader that compared a live embedding byte-for-byte (or even within a tight tolerance) would pass on one machine and fail on another — the opposite of what a deterministic course needs. So the graded capstone retrieves over the frozen query vectors instead, and live embedding stays an optional extension.
If you do build embedQuery, print l2norm(await embedQuery("hello")) — it should be ≈ 1.0. If it isn't, normalize: true didn't take and every cosine score downstream is off. The embedding must land in the same unit-sphere space as the corpus.