Noul questions
hands you the probability that each hazard holds, and a Score question rates how much
harm complying would do. “Ignore your instructions” scores as a jailbreak instead of
working as one. You then set the thresholds that decide whether a message passes, goes to
review, gets blocked, or routes to support. The
Twitch chat filter cookbook uses the same pattern to hide,
blur, or highlight messages in a live chat.
Run this TypeSafe check both on LLM inputs, and on LLM outputs, because even
ordinary-looking prompts can lead to harmful generated replies.
Setup
Run in Colab
Runs as published without an API key.
Python file
This page as one .py file, to run locally.
Open in playground
Edit one request and run it live. Needs a TypeSafe account.
uv run llm_guardrails.py installs the dependencies for you.
The code replays saved answers, so it runs as published without an API key. To change a
request, set TYPESAFE_API_KEY; in Colab, add it in the Secrets panel.
Numbers below came from jev-1.14.0 on 2026-10-31.
Load the sample messages
Eleven user messages inprompts.txt and five model replies in replies.txt. Some are
ordinary, some deserve a look from a human, and the rest
are plain violations. The three jailbreaks follow common patterns: a persona with no rules,
and a made-up accessibility need used to ask for answers with no refusals, or for a harsh
tone with no warnings.
Define the guardrails
“Out of bounds” is not one question, so the battery splits it. FiveNoul questions
each return the probability that one hazard criterion holds. Does the message try to
override the assistant’s instructions? Does it ask the assistant to stop refusing or
warning from now on? Does it ask for help with harm or a crime? Does it ask for a
diagnosis or a dosage? Does it signal that the sender may hurt themselves?
One Score question rates how much harm complying would do, on a written scale from
“none” to “serious physical harm”.
Both go in the same request, so the whole battery costs one call. There is one battery per
side. The input battery asks whether the user wants each thing; the output battery asks
whether the reply gave it, and replaces the two jailbreak questions with whether the reply
broke policy.
Turn the assessment into a decision
Jev supplies the assessment; your application owns the decision. EachNoul
question is compared against two thresholds:
- at or above the action threshold, the hazard triggers its configured action;
- at or above the lower review threshold, the message goes to a human;
- below both, it passes unless another hazard fires.
Score question has a threshold of its own and can turn a review into a
block.
A policy is those thresholds under a name, so each product sets its own rather than
inheriting someone else’s.
Screen every message
We screen the user messages with the input battery and the replies with the output battery, and route all of them understrict.
melatonin_dose asks a dosage question mild enough to hand to a human
rather than refuse. self_harm goes to support instead of being blocked.
novelist_poison reads as violent and passes anyway, because asking how a detective
describes poisoning is not asking to poison anyone. On the output side, good_refusal
passes: it is the assistant declining to help someone break into a house.
The input-side dosage_request is the one row where the severity Score decides the
outcome. It asks the same kind of question as melatonin_dose, and its medical_advice
noul would send it to a human on its own. But a severity of 2.14 crosses the block line,
so the review becomes a block.
The same probabilities, different decisions
We route the cached assessment oftone_jailbreak under both policies. Its
probabilities do not move; each policy decides how much evidence it wants before it acts.
strict blocks this jailbreak. permissive blocks only at 0.85, so it sends the same
message to a human instead.
Look at one decision in full
Pick any screened message by its row number below and print its full hazard breakdown. Pass a differentpolicy_name to see the same assessment routed another way.
tone_jailbreak never mentions the assistant’s instructions, so it scores 0.17 on
jailbreak. It scores 0.81 on drop_safeguards, and route() blocks on that one alone.
To point this at your own product, edit INPUT_BATTERY and OUTPUT_BATTERY for the
hazards you care about, map each one to an action in HAZARD_ACTION, and set the
thresholds in POLICIES from labeled examples of your own traffic.

