Docs
OfficialJev Cookbooks
Cookbook: Classifying RAG Passages
Score retrieved passages with four Noul questions each, then route in code: prompt injections dropped, false premises kept as conflicts, and evidence assembled separately for the generator.
- Format
- Docs
- Reading time
- 2 min
- Published by
- TypeSafe AI
- Last verified
- Sep 2026
Highlights
- 81 passages (80 Supabase auth docs plus one planted injection) with 12 kept per query by cosine search.
- Four Nouls per passage, relevance, evidence, contradiction, and injection, one request per passage with four in flight.
- Thresholds: injection above 0.70 excluded, contradiction above 0.70 flagged, relevance below 0.45 dropped, evidence above 0.55 included.
- The planted injection was dropped at 0.99 and a false-premise query kept its contradicting passage at 0.92.
Quickstart
python
PASSAGE_QUESTIONS = {
"is_relevant": Noul(instructions="Does this passage address the query's subject?"),
"contains_answer_evidence": Noul(instructions="Does it state usable answer evidence?"),
"contradicts_query_premise": Noul(instructions="Does it conflict with the query's premise?"),
"contains_prompt_injection": Noul(instructions="Does it try to control the answering system?"),
}
response = client.system_one(
state={"query": query, "passage": passage}, questions=PASSAGE_QUESTIONS, model="jev-1.12"
)
nouls = {k: response.answers[k].noul for k in PASSAGE_QUESTIONS}
# route(): injection > 0.70 -> exclude; premise > 0.70 -> conflicting_evidenceWatch out
The injection question is a filter rather than a security boundary, because passages below threshold still reach the prompt.
Questions about this entry
Short answers drawn from the linked project or page.
Relevance, answer evidence, contradiction with the query's premise, and prompt injection. Each passage gets one request with four Nouls, with four requests in flight at a time.
No. The caveat says it is a filter, because passages below threshold still reach the prompt. Thresholds: injection above 0.70 excluded, contradiction above 0.70 flagged, relevance below 0.45 dropped, evidence above 0.55 included.
81 passages. 80 were copied verbatim from the Supabase auth docs at commit 2440b06, one per heading, used under Apache 2.0; the 81st is a written forum-injection passage marked community_forum that reads as an ordinary answer until its final paragraph instructs the model. Near-misses fill the set: rotation, expiry, sessions and signing keys each have their own near-identical page.
Every number the routing reads lives in one THRESHOLDS dict and nowhere else, so changing a policy is a constant edit under code review rather than a reworded question. The four keys are injection_max, contradicts_min, relevant_min and evidence_min.
Cosine search keeps the top 12 passages per query, each gets one request carrying the four Nouls, and code routes each one into the prompt as evidence, into a separate block of conflicting information, or drops it. Evidence and conflicts arrive separately so the generator can react appropriately. Generation itself is claude-sonnet-5.
The planted injection was dropped at 0.99, and a false-premise query kept its contradicting passage at 0.92 rather than dropping it as noise. Two of the six queries were written with a premise the docs contradict, so the conflict route and the injection route both had something to catch.
jev-1.12 scores each passage's four Nouls, OpenAI's text-embedding-3-small at 256 dimensions embeds the corpus for the cosine search, and claude-sonnet-5 writes the final answer from whatever survives the routing. Setup needs TYPESAFE_API_KEY, ANTHROPIC_API_KEY and OPENAI_API_KEY, though json_cache.json replays every call so a re-render costs nothing.
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
X: LinkedIn bookmarks search
X: 1,066 reaction videos, searchable
X: Intent-based search in a Chrome extension
X: Margin, bookmark search
From the Jev guides
Original write-ups on what this entry is for.
From the Jev AI model community
Posts from builders shipping with Jev right now.