Launch offer+40%Claim →

Jev reranking for RAG: keep the passages that answer the question

Score each retrieved passage for actual relevance to the question and drop the ones that only matched on embedding similarity.

Run this example

1 question · no key needed

The problem

Vector search returns things that are semantically near but not useful. Stuffing all of them into context costs tokens and dilutes the answer, while a cross-encoder reranker is another model to host and tune.

How Jev handles it

Score each candidate passage against a relevance rubric. The calls are cheap and fast enough to run across your whole candidate set, and you get a distribution to threshold rather than an opaque similarity number.

python
RELEVANCE = Score(
    instructions="How useful is this passage for answering the question?",
    criteria=["Irrelevant", "Tangential", "Useful", "Directly answers"],
)

def rank(passage):
    response = client.system_one(
        model="jev-latest",
        state=f"QUESTION: {question}\n\nPASSAGE: {passage.text}",
        questions={"relevance": RELEVANCE},
    )
    return response.answers["relevance"]

scored = [(p, rank(p)) for p in candidates]
# score is a 0..3 weighted mean: 2 = "Useful", 3 = "Directly answers"
keep = [p for p, s in scored if round(s.score) >= 2]
Measured outputtypesafe/jev-1.13 · 2026-09-18

State sent the example loaded in Run this example above, as it first appears.

Answers returned

relevanceTangential (0.96)
confidence85%
Tangential86%
Irrelevant9%
Useful5%
Directly answers0%
Latency (median of 3)
562.7ms
Minus network floor (198.8ms)
≈364ms
Input tokens
364
Cost
$0.00001529

The classic vector-search false positive: same topic, does not answer the question.

Wording the relevance rubric for Jev reranking

Four ordered levels give Jev reranking two useful cut points: drop everything below Useful, and keep only Directly answers when the context budget is tight. The boundary that matters most is Tangential against Useful — same topic, but does it help? — so spend your wording there. The measured passage is the textbook near-miss: it explains where API keys are created when the question asks how to rotate one without downtime, and 0.86 of the probability went to Tangential.

Sort the survivors on the raw score rather than the rounded band. A 2.9 and a 2.1 both round to Useful and are not equally good, and Jev's weighted mean orders them for you. When your corpus mixes product versions or regions, a Noul asking whether the passage applies to the version named in the question catches a mismatch that similarity search cannot see.

What to put in the state

Jev reranking judges one passage against one question, so keep the fixture's two labelled parts, QUESTION and PASSAGE, and pass the user's question verbatim rather than the rewritten search query — the rubric asks about answering the question, so the question is what it needs. Add the source document's title and section heading where you have them; a breadcrumb like "Settings > API" tells Jev where a chunk came from.

Do not include neighbouring chunks: they turn one judgement into several. Chunk size is the real lever, because an oversized chunk buries the one relevant sentence among unrelated text, and every token of it is billed once per passage per query.

What one decision costs

Jev reranking for RAG multiplies calls by the size of the candidate set, so price a query, not a call. First line: the measured passage. Second: one query with 20 candidates of that size, one call each. Third: 100,000 such queries a month.

arithmetic
# the measured passage, one Score
364 tokens × $0.042 / 1M = $0.0000153

# one query, 20 candidates at that size
20 × 364 = 7,280 tokens × $0.042 / 1M = $0.000306

# 100,000 queries a month, 20 candidates each
2,000,000 × 364 = 728,000,000 tokens × $0.042 / 1M = $30.58

Watch the request limit before the bill. At 80 requests a second, one call per passage caps you at four twenty-candidate queries a second. Putting several passages into one state with a Score question for each cuts the request count, at the price of every question seeing the other passages as noise — measure both on your own data.

Jev's answers on the measured call — relevance: 0.96 of 3, $15.29 per million calls

When not to use Jev for this

Where it fits in your stack

Jev reranking for RAG belongs between the vector store and the generator: retrieve generously for recall, score every candidate, keep those at or above your band, and hand the survivors to the LLM in score order. Embeddings stay in charge of recall; Jev decides which of the recalled passages earn a place in the context.

Cache scores on the question-and-passage pair — the measured pair scored between 0.93 and 0.97 across five runs, so a repeat call buys little. Then log dropped passages next to a rating of the final answer: if good answers keep needing passages you dropped, the cut point is too high. typesafe-jev-examples has a reranking example that runs through OpenRouter.

Notes from the field

Common questions

Why not have an LLM rate relevance from 0 to 3?

Because borderline passages are where integer ratings split. Given the measured passage five times each, with sampling left at its defaults, Gemini 2.5 Flash Lite answered 0 every time, Mistral Small 3.2 answered 1 every time, and GPT-5 nano gave 1 four times and 0 once. Jev's weighted mean stayed between 0.93 and 0.97 — Tangential, leaning slightly towards Irrelevant — which is an ordering you can sort on.

Is Jev reranking fast enough for interactive search?

Per call, yes: the measured passage took 310 ms median against the first-party API, and the calls for one query can run concurrently. The request limit is the tighter constraint, as the arithmetic above shows.

Can you build RAG with Jev?

Not with Jev alone: it neither retrieves nor writes, so Jev is not an alternative to RAG. It does the judging inside a RAG pipeline: reranking passages as on this page, a Noul asking whether the retrieved context answers the question at all, so the bot can say it does not know instead of guessing, and a check that the draft sticks to its sources before it ships (Jev guardrails).

Does it replace a cross-encoder reranker?

It does the same job without a model to host, and returns a distribution instead of a bare similarity number. Whether it ranks better than your cross-encoder is something this site has not measured; run both over queries where you already know the right passages.