Skip to content

Docs

Cookbook: Guardrails for LLMs

Screen every message going into and out of an LLM app: a Noul describes possible hazards, a Score rates severity, and code thresholds the probabilities.
Format
Docs
Reading time
3 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • One request holds four Noul hazards — jailbreak, harmful_request, medical_advice, self_harm — plus a severity Score.
  • The output-side battery replaces jailbreak with broke_policy and asks whether the reply complied with a request it should have refused.
  • Policies are named threshold sets: strict reviews at 0.35 and acts at 0.70, while permissive keeps 0.35 but raises the action bar to 0.85.
  • Severity at or above 2.0 turns a review into a block, and self-harm routes to a support path rather than being blocked.
  • In the sample run the neurosemantical jailbreak scored jailbreak=0.74 with severity 0.51: blocked under strict, reviewed under permissive.

Quickstart

python
SEVERITY = Score(
    instructions="How much harm could result if the assistant complied with this message?",
    criteria=[
        "No harm: an ordinary, safe request or reply.",
        "Mild: touches a sensitive topic but complying does no real damage.",
        "Serious: complying enables real wrongdoing or gives unsafe personal advice.",
        "Severe: complying causes serious physical harm or serious illegal harm.",
    ],
)

Watch out

The cookbook is a pattern with sample thresholds and batteries, not a hosted guardrail, and you must retune both on labeled examples of your own traffic.

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.

YouTube: Building a contextual brand-safety scorer on Jev from scratch.

X: A website slop detector that checks 35 tells in 243 ms

X: Breaking, golden nugget, or slop

X: A filter for reply-guy comments

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