Skip to content

Commit ae566d0

Browse files
dni138claude
andauthored
feat(prompts): register author-published prompt variants (#20, #87) (#204)
* feat(prompts): add verbatim author prompt-variant data module Byte-exact copies of the alternate prompt templates each judge's authors publish (Prometheus grading templates, Selene YAML templates, GLIDER prompt + data wrappers, ShieldGemma prompt-only/prompt+response, PolyGuard full taxonomy, DynaGuard full reasoning format). Harvested from raw author sources and stored json-encoded so intentional author whitespace (e.g. trailing spaces) survives the trailing-whitespace hook. Stdlib-only leaf, imported by prompt_registry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(prompts): register author-published prompt variants (reference-only) Add each judge's author-published alternate prompts as additional named versions alongside the runtime default: Prometheus (6 grading templates + 2 systems), Selene (5), GLIDER (canonical + 3 data wrappers), ShieldGemma (prompt-only, prompt+response), PolyGuard (full S1-S14 system), DynaGuard (full reasoning format). Each is overridable=False with a verified author source URL — for discovery, copy/adaptation, and #194 pinning, not drop-in runtime swaps (their placeholder/output contracts differ from the guardrail's default pipeline). resolve_prompt now rejects a reference-only version selected via prompt_version= with a clear ValueError (previously it would fail with a cryptic KeyError deep in _pre_processing); get_prompt/list_prompt_versions still expose them for discovery. The harvest also revealed three defaults were mislabeled provenance=author when their text actually diverges from the author source (Prometheus adds a 'Feedback:' prefix, PolyGuard drops the whole S1-S14 taxonomy, DynaGuard simplifies the answer format), so their labels are corrected to 'adapted' and the true verbatim author text is registered alongside. Byte-exactness re-verified against a fresh fetch of every cited source; provenance independently audited (all authoritative). Regenerates schemas/guardrail_prompts.json and docs/prompt_catalog.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(prompts): cover reference-only enforcement + verbatim author quirks Assert every non-default variant is reference-only + author-provenance + sourced; that resolve_prompt rejects reference-only versions while get_prompt still returns them and inline prompt= is honored; that the data module is an import-free leaf; and that author quirks are preserved byte-for-byte (GLIDER 'must in' typo + trailing space, ShieldGemma double space, Prometheus's no-'Feedback:' output line, PolyGuard's embedded S1-S14 taxonomy). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(prompts): document author-published prompt variants Correct the guide's claim that variants are swappable via prompt_version= (they are reference-only), add a Prometheus example listing/inspecting variants, and link the browsable prompt catalog. Note that selecting a reference-only version at runtime raises ValueError. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(prompts): address Copilot review on #204 - resolve_prompt's reference-only error now suggests AnyGuardrail.get_prompt(GuardrailName.<NAME>, ...) (enum form) instead of a bare string, so the copy-pasted snippet type-checks. - Reword the _authored_prompt_data docstring to describe the actual encoding (single-line escaped literals; no whitespace at a physical line end) rather than 'double-quoted' (ruff-format switches some literals to single quotes to minimize escapes). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fbc265c commit ae566d0

6 files changed

Lines changed: 1285 additions & 25 deletions

File tree

0 commit comments

Comments
 (0)