Skip to content

< 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.

Start: A score question for one passageSign in to run steps and keep your progress.
  1. Part 01 · 5 steps

    Score the passages

    One request: Jev rates every passage against the question.

    1. 01A score question for one passagenext
    2. 02Batches
    3. 03Score every passage
    4. 04The best passages
    5. 05Search by decision
  2. Part 02 · 3 steps

    Pick the document

    Ask which document to search before scoring its passages.

    1. 06A title for each document
    2. 07Pick the document
    3. 08Search the chosen document
  3. Part 03 · 3 steps

    Decide whether to answer

    Off topic, or nothing scores high enough: say so before the model writes a word.

    1. 09The best score
    2. 10Is this even a store question?
    3. 11Is there a passage that answers it?
  4. Part 04 · 4 steps

    Write the answer

    The chat model, the numbered sources, citations.

    1. 12The prompt
    2. 13Ask the chat model
    3. 14The sources an answer cites
    4. 15Answer, or abstain
  5. Part 05 · 2 steps

    Check the answer

    Every sentence against the sources, one request.

    1. 16A yes/no per sentence
    2. 17The unsupported sentences
  6. Part 06 · 3 steps

    The system

    Build, answer, report.

    1. 18Build the system
    2. 19Answer a question
    3. 20Report the result