Downloads · 30 days
0
sanjxz/Laguna-S-2.1-Agentic-Chat-Template-Jinja
Laguna-S-2.1-Agentic-Chat-Template-Jinja is a machine learning model from sanjxz. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A drop-in Jinja chat template for Poolside Laguna S 2.1, rendering the model's native conversation format. It carries the same v24.0-loopguard agentic hardening as the Qwen fork (https://huggingface.co/sanjxz/Qwen-Fix…
Downloads · 30 days
0
Access
Public
Updated Jul 28, 2026
Repo size
—
Likes
9
Public
Click a slice to open those files.
.jinja53.1 KB · 74%
From the Hugging Face model README
A drop-in Jinja chat template for Poolside Laguna S 2.1,
rendering the model's native conversation format. It carries the same
v24.0-loopguard agentic hardening as the Qwen fork (https://huggingface.co/sanjxz/Qwen-Fixed-Chat-Templates/tree/main), re-expressed in
Laguna's <system> / <user> / <assistant> token scheme.
laguna-s21-froggeric-v24.0-loopguard| File | Internal version | What it is |
|---|---|---|
chat_template_laguna.jinja | laguna-s21-froggeric-v24.0-loopguard | The maintained template — full loop-guard, security hardening, tool + skill integration, developer-role support. Use this. |
chat_template_laguna-orig.jinja | laguna_glm_thinking_v8 iteration | The minimal upstream original (no loop-guard, no security strip, no truncation). Kept for reference/diffing only. |
Laguna does not use <|im_start|> ChatML. The template emits:
| Element | Rendering |
|---|---|
| Sequence prefix | `〈 |
| System / developer | <system>…</system> |
| User | <user>…</user> |
| Assistant | <assistant>…</assistant> |
| Reasoning | <think>…</think> |
| Tool schemas | inside <system>: ### Tools + <available_tools> (one JSON schema per line) |
| Tool call | <tool_call>name<arg_key>k</arg_key><arg_value>v</arg_value>…</tool_call> |
| Tool result | <tool_response>…</tool_response> |
| Image / video | literal [image] / [video] placeholder |
| Default system | "You are a helpful, conversationally-fluent assistant made by Poolside…" (a caller-supplied empty system message opts out of it) |
Example assistant turn with a tool call:
<assistant><think>I should check the weather.</think><tool_call>get_weather<arg_key>location</arg_key><arg_value>NYC</arg_value></tool_call></assistant>
The agentic internals are identical to the Qwen fork — see the "What the fork adds over the
original" section of README.md for the full write-up. In brief, this template adds
over chat_template_laguna-orig.jinja:
<available_tools> block with a
suspension notice so the model cannot emit a tool call.$ (shell) and took (timing) false-positive
escapes. Read tools are exempt from error-text matching; results are attributed via
tool_call_id → name.sanitize_tool_tokens strips literal <|think_off|> /
<|think_on|> from untrusted tool output.skill-tool triggering, vanished-tool warnings,
strftime_now date injection, OpenAI {"type":"function",…} wrapper unwrapping,
middle-out tool-response truncation, <__media__> marker stripping, unclosed-reasoning recovery.OpenAI-style APIs send a developer role. Laguna has no native developer tag, so the
template folds developer into <system>:
developer message becomes the system message.developer message renders as <system>…</system> (not the generic
<user>[developer]: … fallback).If your client sends developer-role prompts, set its supportsDeveloperRole flag to true.
Override via your engine's chat_template_kwargs (llama.cpp: --chat-template-kwargs '{"…":…}').
| Kwarg | Default | Purpose |
|---|---|---|
enable_thinking | true | Master reasoning switch |
preserve_thinking | true | Keep prior <think> blocks in history (100% prefix-cache friendly). This is the variable --reasoning-preserve sets. |
add_generation_prompt | false | Emit the trailing <assistant> generation prompt |
auto_disable_thinking_with_tools | false | Force thinking off whenever tools are present |
max_tool_arg_chars | 0 | Truncate long tool-call arguments (0 = no limit) |
max_tool_response_chars | 0 | Middle-out truncate long tool responses (0 = no limit) |
sanitize_tool_tokens | true | Strip literal think-toggle tokens from tool output |
fail_warn_after / fail_halt_after | 2 / 5 | Consecutive tool errors → escalated warning / hard halt + tool suspension |
repeat_warn_after / repeat_halt_after | 2 / 4 | Identical call signatures (two-turn window) → warning / halt |
repeat_nudge_after | 6 | Identical tool results before nudge (0 = off) |
pingpong_nudge_after | 4 | Identical signatures incl. mutating tools before nudge (0 = off) |
think_on_tool_failure | true | Prime an open <think> with diagnostics on failure |
warn_vanished_tools | true | Warn when previously-used tools disappear from the tool list |
vanished_tools_window | 10 | Only warn about vanished tools used within the last N messages (0 = scan full history) |
tool_call_format | xml | Tool-call rendering: xml (<arg_key>/<arg_value> pairs) or json ({"name":…,"arguments":{…}} inside <tool_call>) |
enable_toolcall_instructions | false | Inject the "how to call functions" reminder into the system block; false lists tools only (like the stock template) |
mutating_tools / read_tools | (built-in lists) | Space-separated tool names driving the heuristics |
History tool calls and the format reminder are rendered in one of two formats, selected with tool_call_format.
XML (default) — arguments as <arg_key>/<arg_value> pairs:
<tool_call>get_weather<arg_key>location</arg_key><arg_value>NYC</arg_value></tool_call>
JSON (tool_call_format='json') — a single JSON object inside the <tool_call> envelope:
<tool_call>
{"name": "get_weather", "arguments": {"location": "NYC"}}
</tool_call>
max_tool_arg_chars truncates per-argument values in XML mode and the whole serialized arguments object in JSON mode.
Point --chat-template-file at the template and enable --jinja. Example for Laguna S 2.1 APEX:
import os
import subprocess
import sys
env = os.environ.copy()
env["GGML_CUDA_NO_PINNED"] = "1"
env["GGML_CUDA_DISABLE_GRAPHS"] = "1"
cmd = [
r".\llama-server.exe",
"-m", r"D:\Laguna-S-2.1-APEX-i-compact.gguf",
"--reasoning-preserve",
"--reasoning-budget", "16000",
"--reasoning-budget-message", "I've thought enough. Answering now with what I have.",
"-ngl", "999",
"--n-cpu-moe", "47",
"--rope-scaling", "yarn",
"--rope-scale", "20",
"--yarn-orig-ctx", "8192",
"--yarn-attn-factor", "1.0", # experimental fix -- https://www.reddit.com/r/LocalLLaMA/s/tZmaypD6zp
"--load-mode", "mlock", #recent llama.cpp only ; --mlock & --no-mmap alternative
"-c", "160000",
"--cache-type-k", "q8_0",
"--cache-type-v", "q8_0",
"-np", "1",
"-fa", "on",
"-t", "8",
"-tb", "8",
"-b", "3840",
"-ub", "3840",
"--jinja",
"-kvu",
"--temp", "0.6",
"--top-p", "0.95",
"--top-k", "20",
"--min-p", "0.02",
"--dry-multiplier", "0.6",
"--dry-base", "1.75",
"--dry-allowed-length", "4",
"--dry-penalty-last-n", "-1",
"--dry-sequence-breaker", r'\n,:,\",*,;,{,}',
"--samplers", "top_k;top_p;min_p;temperature;dry",
"--alias", "laguna-s-2.1",
"--cache-reuse", "256",
"--cache-ram", "1024",
"--host", "127.0.0.1",
"--port", "8080",
"--verbosity", "4",
"--chat-template-file", r"G:\xlam3\laguna\chat_template_laguna.jinja",
]
if __name__ == "__main__":
try:
print("Starting llama-server...")
subprocess.run(cmd, env=env, check=True)
except KeyboardInterrupt:
print("\nServer stopped by user.")
except Exception as e:
print(f"\nError running server: {e}")
| Role | Author |
|---|---|
| Base model | Poolside (Laguna S 2.1) |
| Template lineage / fixes | froggeric + fork contributors |
MIT.