Azrael Chat Template

Built for: moeshawky/Azrael-ternary-9B.

Upstream compatibility: The canonical template remains byte-identical to, and render-compatible with, the standalone chat_template.jinja published with ornith-ai/Ornith-1.5-9B. This repository is an Azrael distribution; it is not an official Ornith release.

The repository distributes the Ornith-1.5-9B chat formatter used by Azrael, plus the scripts needed to verify and install it. The formatter is the upstream Ornith-1.5-9B standalone template, unchanged.

The template is a message formatter. It does not contain a model identity, behavioral instructions, a reasoning policy, or harness integration. Those are supplied by the calling runtime as ordinary system messages.

What is in this repository

File Purpose
chat_template.jinja Canonical Jinja template, byte-identical to upstream Ornith-1.5-9B.
chat_template_oneline.txt Deterministic single-line form for tokenizer_config.json or runtimes that require one line.
scripts/verify.py Acceptance gate. Renders messages and checks the serialization contract.
scripts/check_applied.py Inspects a model directory or GGUF and reports whether all template sources agree.
scripts/minify_jinja.py Regenerates chat_template_oneline.txt from the canonical template.

Measured artifacts:

Artifact Size SHA256
chat_template.jinja 7,593 bytes / 150 logical lines 9dd2fbd270feaa1fbef2d4f634d7887c9c506e3bde140f8e7351c8944e8fd235
chat_template_oneline.txt 5,988 bytes / 1 line 4cb03a2454f4abf362d687507a0b70aedaa0a8ca0a831541e0db538e7d021c8b

Relationship to the Ornith chat format

The canonical file is the standalone chat_template.jinja published with ornith-ai/Ornith-1.5-9B. It preserves that template's tokenizer conventions and serialization:

  • Turns use the native <|im_start|>role\n...<|im_end|>\n boundaries.
  • Assistant turns carry reasoning in <think>...</think>.
  • Tool declarations use the Qwen3 XML <tools> block and the <tool_call><function=...><parameter=...> call wire.
  • Tool results are wrapped in a user turn with <tool_response>...</tool_response>.
  • Consecutive tool results are bundled into one user turn.
  • Vision content uses <|vision_start|><|image_pad|><|vision_end|> and the matching video tokens.
  • enable_thinking controls the assistant generation prefix only.

No tokenizer was modified. No vocabulary or special-token definition is added by this repository.

Template sources

Upstream also publishes an embedded copy of the template in tokenizer_config.json. That embedded copy is not byte-identical to upstream's standalone chat_template.jinja: it drops historical assistant reasoning for turns before the last user query, while the standalone file serializes that reasoning. This repository distributes the standalone form as canonical.

If you embed the template, embed chat_template_oneline.txt from this repository, not the embedded copy from the upstream model snapshot. Then run scripts/check_applied.py to confirm that every source present renders the same prompts.

Install

Option A: standalone Jinja file

Copy the canonical template into the model directory:

cp chat_template.jinja /path/to/model/chat_template.jinja

Recent transformers versions prefer this file over an embedded copy.

Option B: embedded in tokenizer_config.json

Some runtimes read only the chat_template key. Embed the minified canonical form without disturbing any other config keys:

python3 - <<'PY'
import json
import pathlib

model_dir = pathlib.Path("/path/to/model")
config_path = model_dir / "tokenizer_config.json"
template = pathlib.Path("chat_template_oneline.txt").read_text(encoding="utf-8")

config = json.loads(config_path.read_text(encoding="utf-8"))
config["chat_template"] = template
config_path.write_text(
    json.dumps(config, indent=2, ensure_ascii=False) + "\n",
    encoding="utf-8",
)
PY

If both sources exist, check them together:

python3 scripts/check_applied.py /path/to/model

For a GGUF build:

python3 scripts/check_applied.py model.gguf

The checker reports every source it finds, whether each source renders the Ornith wire correctly, whether they agree with each other, and whether any retired behavioral directive is present.

Supplying the minimal Azrael identity

The identity is a normal system message. The template does not add it, replace it, or duplicate it.

Canonical usage:

from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("/path/to/model")

messages = [
    {"role": "system", "content": "You are Azrael, an AI model created by Moe S."},
    {"role": "user", "content": "Hello"},
]

prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True,
)

The rendered prompt begins:

<|im_start|>system
You are Azrael, an AI model created by Moe S.<|im_end|>
<|im_start|>user
Hello<|im_end|>
<|im_start|>assistant
<think>

Rules for callers:

  • Supply the identity as messages[0] with role: "system".
  • Do not add a second copy in the template; it is not there.
  • If no system message is supplied, no identity is injected. The rendered prompt contains no model name.
  • An existing caller system message is preserved verbatim and is not replaced.
  • When tools are present, the caller system message is appended after the # Tools block inside the same system turn.

Reasoning mode

enable_thinking is generation-mode control, not a permanent behavioral commitment:

  • enable_thinking=True ends the prompt with <|im_start|>assistant\n<think>\n.
  • enable_thinking=False ends the prompt with <|im_start|>assistant\n<think>\n\n</think>\n\n.

Historical assistant reasoning is serialized from reasoning_content independently of enable_thinking. Turning generation thinking off does not erase reasoning already present in the conversation history.

The template does not define synthetic reasoning levels, stages, or an always-on policy. The default reasoning policy for a deployment is a runtime choice and should be measured against the complete model-and-runtime system.

Tool calling wire

With tools supplied, the system block starts with:

# Tools

You have access to the following functions:

<tools>
...
</tools>

An assistant tool call is emitted as line-delimited XML:

<tool_call>
<function=read_file>
<parameter=path>
/etc/hostname
</parameter>
</function>
</tool_call>

A tool result is returned inside a user turn:

<|im_start|>user
<tool_response>
myhost
</tool_response><|im_end|>

Multiple consecutive tool results share that user turn. The assistant continues with the normal <|im_start|>assistant\n<think>\n prefix.

Verify

Run the acceptance gate:

python3 scripts/verify.py

The gate renders actual prompts for plain chat, existing system messages, the minimal identity, multi-turn history, thinking on/off, tool calls, tool results and continuation, consecutive tool results, multimodal content, and the minified template. It also checks that no retired behavioral directive appears in rendered output.

Compare directly against a local upstream copy:

python3 scripts/verify.py --ornith /path/to/ornith/chat_template.jinja

This checks the upstream SHA256 and renders both templates across every fixture. The canonical file is byte-identical to the upstream standalone template, so this comparison must pass.

Check an embedded config:

python3 scripts/verify.py --tokenizer-config /path/to/model/tokenizer_config.json

Regenerate the minified artifact after any canonical change:

python3 scripts/minify_jinja.py chat_template.jinja chat_template_oneline.txt
python3 scripts/verify.py

verify.py also checks that chat_template_oneline.txt is the exact deterministic output of the minifier, not merely behaviorally similar.

Runtime notes

Upstream Ornith-1.5-9B serving recipes specify:

Runtime Template source Parser flags
transformers >= 5.8.1 chat_template.jinja Use apply_chat_template with enable_thinking.
vLLM >= 0.19.1 file or embedded --tool-call-parser qwen3_xml --reasoning-parser qwen3
SGLang >= 0.5.9 file or embedded --tool-call-parser qwen3_coder --reasoning-parser qwen3
llama.cpp GGUF tokenizer.chat_template Use the GGUF's embedded template.

The Jinja render path is covered by this repository's tests. Live server rollout is environment-dependent and was not run as part of this cleanup.

Provenance and license

The upstream template text is redistributed unmodified under its MIT license. The packaging, documentation, and verification scripts in this repository are provided under Apache-2.0.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moeshawky/Azrael-9b-chat-template

Finetuned
Qwen/Qwen3.5-9B
Finetuned
(1)
this model