Skip to content

Docs

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_evidence

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

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.

Follow @typesafeai