Skip to main content

API reference

Factory names in jes.policies and jes.recipes are stable, and so is the text of every question id: a wording change gets a new question id.

ModuleWhat it holdsPage
jesGuard, AsyncGuard, Limits, Redactions, Result, the question types, the result types, and the errorsGuard, Results, Redactions, Errors
jes.guardGuard, AsyncGuard, and HistoryGuard
jes.limitsLimitsLimits
jes.resultResult, refusal, and finding_nameResults
jes.policiesCore policy factories, judge, and the policy protocolsPolicies
jes.questionsYesNo, Choice, Score, their answers, and ThresholdQuestions
jes.backendTypeSafe, ModelSpec, resolve_model, Request, Reply, and the backend protocolsjes.backend
jes.recipesRecipes: pre-made policy factories that haven't been evaluated yetRecipes
jes.testingFakeBackend and Rule, for testsTesting
jes.types, jes.errors, jes.redactionsThe result types, type aliases, exceptions, and TOKEN_RE. jes re-exports most of them.Results, Errors, Redactions

jes.__version__ is the installed version string, for example "0.0.1".

Conventions​

  • Every judgment factory requires threshold=, as a float or a Threshold. jes ships no default thresholds.
  • stages defaults differ per policy. Each stage is one of "input", "untrusted", "tool_call", "tool_result", or "output". Transforms and judge() take stages=. The built-in judgments and allowed_tools have fixed stages.
  • name= must be unique within a guard and match [A-Za-z][A-Za-z0-9_-]{0,63}.
  • model= on a policy overrides the guard's model for that policy only. It takes a ModelSpec: a TypeSafe model id such as "jev-latest", a classifier, or a backend.