chat-template-checker / index.html
SamJoshua's picture
Point CTT-Bench leaderboard links to agent-security-bench
4ad9943 verified
Raw History Blame Contribute Delete
3.85 kB
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Chat Template Checker · CTT-Bench</title>
<style>
:root{color-scheme:light dark;--b:#d4d4d8;--m:#71717a}
body{font:15px/1.5 system-ui,sans-serif;max-width:1000px;margin:0 auto;padding:20px 16px 60px}
h1{margin:.2em 0}a{color:#2563eb}
.tabs button{padding:6px 14px;border:1px solid var(--b);background:none;color:inherit;cursor:pointer;border-radius:8px 8px 0 0}
.tabs button.on{font-weight:700;border-bottom-color:transparent;background:rgba(128,128,128,.12)}
.panel{border:1px solid var(--b);padding:14px;border-radius:0 8px 8px 8px}
input[type=text],textarea{width:100%;box-sizing:border-box;padding:8px;font:inherit;border:1px solid var(--b);border-radius:8px;background:none;color:inherit}
textarea{font:13px ui-monospace,monospace;min-height:200px}
button.go{padding:8px 18px;border:0;border-radius:8px;background:#4f46e5;color:#fff;font:inherit;cursor:pointer}
button.go:disabled{opacity:.5}
.row{display:flex;gap:10px;margin-top:8px}.ex{margin-top:8px;font-size:13px}.ex a{margin-right:10px;cursor:pointer}
.card{display:flex;gap:18px;align-items:center;padding:14px 18px;border:1px solid var(--b);border-radius:12px;margin:16px 0}
.err{color:#b91c1c}.score{font-size:42px;font-weight:700;min-width:96px;text-align:center}.verdict{font-weight:600}.sub{font-size:13px;color:var(--m)}
table{border-collapse:collapse;width:100%;font-size:13px}td,th{border:1px solid var(--b);padding:6px 8px;vertical-align:top;text-align:left}
td.what{font-family:ui-monospace,monospace;font-size:12px;word-break:break-word}
#status{color:var(--m);font-size:13px;margin-top:8px}
</style></head><body>
<h1>Chat Template Checker</h1>
<p>Does a model's chat template survive real tool calls? Enter a Hub model id and this runs the 10
<a href="https://huggingface.co/datasets/SamJoshua/chat-template-toolcall-bench">CTT-Bench</a> cases through the template.
Everything runs <b>in your browser</b> (Python + Jinja via Pyodide); only the small template files are fetched from the Hub, never weights.
The most common failure: the template crashes when <code>arguments</code> is a JSON string, the format OpenAI-compatible clients send.
<a href="https://samjoshua-agent-security-bench.static.hf.space/#ctt">Leaderboard</a> ·
<a href="https://samjoshua-agent-security-bench.static.hf.space/ctt/article.html">Write-up</a></p>
<div class="tabs"><button id="t1" class="on">Hub model</button><button id="t2">Raw template</button></div>
<div class="panel">
<div id="p1"><div class="row"><input type="text" id="repo" placeholder="org/model, e.g. zai-org/GLM-5.3" autofocus><button class="go" id="go">Check</button></div>
<div class="ex">Try: <span id="exs"></span></div></div>
<div id="p2" hidden><textarea id="raw" placeholder="Paste a Jinja chat template"></textarea>
<div class="row"><input type="text" id="bos" placeholder="bos_token (optional)"><input type="text" id="eos" placeholder="eos_token (optional)"><button class="go" id="goraw">Check template</button></div></div>
<div id="status">Loading the in-browser Python runtime…</div>
</div>
<div id="out"></div>
<p class="sub">A crash on string arguments is a spec-compatibility gap, not a model-quality bug: transformers documents <code>arguments</code> as a dict. It still breaks agents that pass OpenAI-format messages straight through.
Checks run anonymously, so gated repos need the Raw template tab. Same renderer settings as <code>apply_chat_template</code> (sandboxed Jinja, same filters) and the same pass rules as the leaderboard; scores were verified against transformers 5.22.2.
Built by <a href="https://huggingface.co/SamJoshua">Sam Joshua</a> · <a href="https://x.com/SAM_JOSHUA_S">@SAM_JOSHUA_S</a></p>
<script type="module" src="app.js"></script>
</body></html>