< all projects20 steps · medium · Rebuild
Build a RAG system on Jev
You will have built a RAG system whose retrieval is a decision model, not an embedding model, one small function at a time: 5 functions that have Jev score every passage against the question in one request and keep the best, 3 that pick the document to search first, 3 that decide whether the question can be answered at all, 4 that write the answer with the chat model and read its citations, 2 that check every sentence against the sources in one request, and 3 that put it together and report what was decided. Jev is TypeSafe's decision model: you send it some content and typed questions (yes/no, a choice, a score on a rubric) and it returns numbers your code branches on, no prose to parse. Here it does everything an embedding model and a reranker would, plus the abstain and groundedness decisions, and the chat model only writes the answer. Both are real: the steps that call them check what they decided and spend a little of your credits. The documents are the same store policies as Build a RAG system, so you can compare the two: there is no index here, every question reads every passage, and the system can say exactly why it answered or refused. When every step has passed, the files assemble into one system and you can ask it anything about the store, live.
Part 01 · 5 steps
Score the passages
One request: Jev rates every passage against the question.
Part 02 · 3 steps
Pick the document
Ask which document to search before scoring its passages.
Part 03 · 3 steps
Decide whether to answer
Off topic, or nothing scores high enough: say so before the model writes a word.
Part 04 · 4 steps
Write the answer
The chat model, the numbered sources, citations.
Part 05 · 2 steps
Check the answer
Every sentence against the sources, one request.
Part 06 · 3 steps
The system
Build, answer, report.