♻️ Quality: skills/create-agent/model_facts.py without smells (3 → 0)
- tool_format as an ordered TOOL_FORMATS table (same tests, same order) - notes as reasoning_notes (+ effort_note), tool_notes and setup_notes, in the same order - template_facts.py: thinking and tool_format, imported by model_facts.py (run by its path, so its folder is on sys.path) Checked: facts() and text_report() byte-identical old vs new on 18 synthetic /api/show answers (the 7 tool-call formats, reasoning switches and effort values, with and without architecture facts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fc3d5e4 parent: e6108b0 modified
skills/create-agent/model_facts.py +29 -47 | @@ -22,6 +22,8 @@ import re | ||
| 22 | 22 | import sys |
| 23 | 23 | import urllib.request |
| 24 | 24 | |
| 25 | +from template_facts import thinking, tool_format | |
| 26 | + | |
| 25 | 27 | BASES = ["http://127.0.0.1:17434", "http://host.docker.internal:17434"] |
| 26 | 28 | |
| 27 | 29 | |
| @@ -42,46 +44,6 @@ def find_base(explicit): | ||
| 42 | 44 | sys.exit("llmman does not answer on " + ", ".join([explicit] if explicit else BASES) + " — start it: llmman serve") |
| 43 | 45 | |
| 44 | 46 | |
| 45 | -def thinking(template): | |
| 46 | - """How the template switches reasoning, and what it does by default.""" | |
| 47 | - t = template | |
| 48 | - out = {"variable": None, "default": None, "effort": None, "effort_values": [], "preserve_thinking": "preserve_thinking" in t} | |
| 49 | - if "enable_thinking" in t: | |
| 50 | - out["variable"] = "enable_thinking" | |
| 51 | - if re.search(r"enable_thinking\s*\|\s*default\(\s*false", t) or re.search(r"enable_thinking is defined and enable_thinking is true", t): | |
| 52 | - out["default"] = "off" | |
| 53 | - elif re.search(r"enable_thinking is defined and enable_thinking is false", t) or re.search(r"enable_thinking is undefined or enable_thinking is true", t): | |
| 54 | - out["default"] = "on" | |
| 55 | - if "reasoning_effort" in t: | |
| 56 | - out["effort"] = "reasoning_effort" | |
| 57 | - m = re.search(r"reasoning_effort\|default\(['\"](\w+)['\"]\)|set reasoning_effort = ['\"](\w+)['\"]", t) | |
| 58 | - if m: | |
| 59 | - out["effort_default"] = m.group(1) or m.group(2) | |
| 60 | - out["effort_values"] = sorted({v for v in re.findall(r"['\"](low|medium|high|xhigh|minimal|none)['\"]", t)}) | |
| 61 | - if out["variable"] is None: | |
| 62 | - out["default"] = "always on (graded by reasoning_effort)" | |
| 63 | - if out["variable"] is None and out["effort"] is None: | |
| 64 | - out["default"] = "reasons, no switch" if ("<think>" in t or "thought" in t) else "no reasoning" | |
| 65 | - return out | |
| 66 | - | |
| 67 | - | |
| 68 | -def tool_format(template): | |
| 69 | - t = template | |
| 70 | - if "<function=" in t: | |
| 71 | - return "xml", "Qwen3-Coder XML: <tool_call><function=name><parameter=key>value</parameter>…" | |
| 72 | - if "<|tool_call>call:" in t: | |
| 73 | - return "gemma", "Gemma 4 DSL: <|tool_call>call:name{key:<|\"|>value<|\"|>}<tool_call|>" | |
| 74 | - if "to=functions." in t or "to=\" }}" in t or "functions." in t and "<|channel|>commentary" in t: | |
| 75 | - return "harmony", "harmony: assistant to=functions.name <|channel|>commentary json<|message|>{…}<|call|>" | |
| 76 | - if "<tool_call>" in t and '"name"' in t: | |
| 77 | - return "json", "Hermes JSON: <tool_call>{\"name\": …, \"arguments\": {…}}</tool_call>" | |
| 78 | - if "[TOOL_CALLS]" in t: | |
| 79 | - return "mistral", "Mistral: [TOOL_CALLS]name[ARGS]{…}" | |
| 80 | - if "tools" in t: | |
| 81 | - return "other", "the template handles tools; read it with --template" | |
| 82 | - return "none", "the template has no tool support" | |
| 83 | - | |
| 84 | - | |
| 85 | 47 | def facts(base, model): |
| 86 | 48 | show = call(base, "/api/show", {"model": model}, timeout=30) |
| 87 | 49 | tags = call(base, "/api/tags").get("models", []) |
| @@ -122,25 +84,45 @@ def facts(base, model): | ||
| 122 | 84 | |
| 123 | 85 | def notes(f): |
| 124 | 86 | """What the facts mean for an mm configuration — the lessons measured in this repository.""" |
| 87 | + fmt = f["tool_calls"]["format"] | |
| 88 | + return reasoning_notes(f["thinking"]) + tool_notes(fmt) + setup_notes(f, fmt) | |
| 89 | + | |
| 90 | + | |
| 91 | +def reasoning_notes(th): | |
| 92 | + """The notes on the reasoning switches: enable_thinking, reasoning_effort, always on.""" | |
| 125 | 93 | n = [] |
| 126 | - th, fmt = f["thinking"], f["tool_calls"]["format"] | |
| 127 | 94 | if th["variable"] == "enable_thinking": |
| 128 | 95 | n.append(f"Reasoning: set sampling.chat_template_kwargs.enable_thinking explicitly (template default: {th['default']}).") |
| 129 | 96 | if th["effort"]: |
| 130 | - values = th["effort_values"] | |
| 131 | - if len(values) > 1: | |
| 132 | - n.append(f"Reasoning effort: chat_template_kwargs.reasoning_effort, one of {', '.join(values)}; a value the template does not know may make every request fail (Qwen3.8's raises).") | |
| 133 | - else: | |
| 134 | - n.append("Reasoning effort: chat_template_kwargs.reasoning_effort — the template names only its default" | |
| 135 | - + (f" ({values[0]})" if values else "") + "; take the other values from the model card (gpt-oss: low, medium, high).") | |
| 97 | + n.append(effort_note(th["effort_values"])) | |
| 136 | 98 | if th["default"] and "always" in str(th["default"]): |
| 137 | 99 | n.append("The model always reasons: give max_tokens room for the reasoning plus a whole tool call (16384+).") |
| 138 | 100 | if th["default"] in ("on",) or th["effort"]: |
| 139 | 101 | n.append("With reasoning on, never use temperature 0.0 (thinking models loop); showThinking: true helps while tuning.") |
| 102 | + return n | |
| 103 | + | |
| 104 | + | |
| 105 | +def effort_note(values): | |
| 106 | + """The reasoning_effort note: the values the template knows, or only its default.""" | |
| 107 | + if len(values) > 1: | |
| 108 | + return f"Reasoning effort: chat_template_kwargs.reasoning_effort, one of {', '.join(values)}; a value the template does not know may make every request fail (Qwen3.8's raises)." | |
| 109 | + return ("Reasoning effort: chat_template_kwargs.reasoning_effort — the template names only its default" | |
| 110 | + + (f" ({values[0]})" if values else "") + "; take the other values from the model card (gpt-oss: low, medium, high).") | |
| 111 | + | |
| 112 | + | |
| 113 | +def tool_notes(fmt): | |
| 114 | + """The notes on the tool-call format.""" | |
| 115 | + n = [] | |
| 140 | 116 | if fmt == "xml": |
| 141 | 117 | n.append("XML tool calls: llama.cpp builds a grammar from each tool schema and imposes NESTED object properties in alphabetical order — keep a custom/MCP tool's nested objects without `properties` (describe them in words) or the model loses fields.") |
| 142 | 118 | if fmt in ("json", "gemma", "harmony", "xml"): |
| 143 | 119 | n.append("parallel_tool_calls: false — one call per reply; small models run tests before the edit lands otherwise.") |
| 120 | + return n | |
| 121 | + | |
| 122 | + | |
| 123 | +def setup_notes(f, fmt): | |
| 124 | + """The notes on sampling, the window, the identity line and the system message.""" | |
| 125 | + n = [] | |
| 144 | 126 | if not f["sampling_in_gguf"]: |
| 145 | 127 | n.append("No sampling in the GGUF: use the model author's published recommendation.") |
| 146 | 128 | ctx = f["architecture"]["context_length"] |
| @@ -22,6 +22,8 @@ import re | |||
| 22 | import sys | 22 | import sys |
| 23 | import urllib.request | 23 | import urllib.request |
| 24 | 24 | ||
| 25 | +from template_facts import thinking, tool_format | ||
| 26 | + | ||
| 25 | BASES = ["http://127.0.0.1:17434", "http://host.docker.internal:17434"] | 27 | BASES = ["http://127.0.0.1:17434", "http://host.docker.internal:17434"] |
| 26 | 28 | ||
| 27 | 29 | ||
| @@ -42,46 +44,6 @@ def find_base(explicit): | |||
| 42 | sys.exit("llmman does not answer on " + ", ".join([explicit] if explicit else BASES) + " — start it: llmman serve") | 44 | sys.exit("llmman does not answer on " + ", ".join([explicit] if explicit else BASES) + " — start it: llmman serve") |
| 43 | 45 | ||
| 44 | 46 | ||
| 45 | -def thinking(template): | ||
| 46 | - """How the template switches reasoning, and what it does by default.""" | ||
| 47 | - t = template | ||
| 48 | - out = {"variable": None, "default": None, "effort": None, "effort_values": [], "preserve_thinking": "preserve_thinking" in t} | ||
| 49 | - if "enable_thinking" in t: | ||
| 50 | - out["variable"] = "enable_thinking" | ||
| 51 | - if re.search(r"enable_thinking\s*\|\s*default\(\s*false", t) or re.search(r"enable_thinking is defined and enable_thinking is true", t): | ||
| 52 | - out["default"] = "off" | ||
| 53 | - elif re.search(r"enable_thinking is defined and enable_thinking is false", t) or re.search(r"enable_thinking is undefined or enable_thinking is true", t): | ||
| 54 | - out["default"] = "on" | ||
| 55 | - if "reasoning_effort" in t: | ||
| 56 | - out["effort"] = "reasoning_effort" | ||
| 57 | - m = re.search(r"reasoning_effort\|default\(['\"](\w+)['\"]\)|set reasoning_effort = ['\"](\w+)['\"]", t) | ||
| 58 | - if m: | ||
| 59 | - out["effort_default"] = m.group(1) or m.group(2) | ||
| 60 | - out["effort_values"] = sorted({v for v in re.findall(r"['\"](low|medium|high|xhigh|minimal|none)['\"]", t)}) | ||
| 61 | - if out["variable"] is None: | ||
| 62 | - out["default"] = "always on (graded by reasoning_effort)" | ||
| 63 | - if out["variable"] is None and out["effort"] is None: | ||
| 64 | - out["default"] = "reasons, no switch" if ("<think>" in t or "thought" in t) else "no reasoning" | ||
| 65 | - return out | ||
| 66 | - | ||
| 67 | - | ||
| 68 | -def tool_format(template): | ||
| 69 | - t = template | ||
| 70 | - if "<function=" in t: | ||
| 71 | - return "xml", "Qwen3-Coder XML: <tool_call><function=name><parameter=key>value</parameter>…" | ||
| 72 | - if "<|tool_call>call:" in t: | ||
| 73 | - return "gemma", "Gemma 4 DSL: <|tool_call>call:name{key:<|\"|>value<|\"|>}<tool_call|>" | ||
| 74 | - if "to=functions." in t or "to=\" }}" in t or "functions." in t and "<|channel|>commentary" in t: | ||
| 75 | - return "harmony", "harmony: assistant to=functions.name <|channel|>commentary json<|message|>{…}<|call|>" | ||
| 76 | - if "<tool_call>" in t and '"name"' in t: | ||
| 77 | - return "json", "Hermes JSON: <tool_call>{\"name\": …, \"arguments\": {…}}</tool_call>" | ||
| 78 | - if "[TOOL_CALLS]" in t: | ||
| 79 | - return "mistral", "Mistral: [TOOL_CALLS]name[ARGS]{…}" | ||
| 80 | - if "tools" in t: | ||
| 81 | - return "other", "the template handles tools; read it with --template" | ||
| 82 | - return "none", "the template has no tool support" | ||
| 83 | - | ||
| 84 | - | ||
| 85 | def facts(base, model): | 47 | def facts(base, model): |
| 86 | show = call(base, "/api/show", {"model": model}, timeout=30) | 48 | show = call(base, "/api/show", {"model": model}, timeout=30) |
| 87 | tags = call(base, "/api/tags").get("models", []) | 49 | tags = call(base, "/api/tags").get("models", []) |
| @@ -122,25 +84,45 @@ def facts(base, model): | |||
| 122 | 84 | ||
| 123 | def notes(f): | 85 | def notes(f): |
| 124 | """What the facts mean for an mm configuration — the lessons measured in this repository.""" | 86 | """What the facts mean for an mm configuration — the lessons measured in this repository.""" |
| 87 | + fmt = f["tool_calls"]["format"] | ||
| 88 | + return reasoning_notes(f["thinking"]) + tool_notes(fmt) + setup_notes(f, fmt) | ||
| 89 | + | ||
| 90 | + | ||
| 91 | +def reasoning_notes(th): | ||
| 92 | + """The notes on the reasoning switches: enable_thinking, reasoning_effort, always on.""" | ||
| 125 | n = [] | 93 | n = [] |
| 126 | - th, fmt = f["thinking"], f["tool_calls"]["format"] | ||
| 127 | if th["variable"] == "enable_thinking": | 94 | if th["variable"] == "enable_thinking": |
| 128 | n.append(f"Reasoning: set sampling.chat_template_kwargs.enable_thinking explicitly (template default: {th['default']}).") | 95 | n.append(f"Reasoning: set sampling.chat_template_kwargs.enable_thinking explicitly (template default: {th['default']}).") |
| 129 | if th["effort"]: | 96 | if th["effort"]: |
| 130 | - values = th["effort_values"] | 97 | + n.append(effort_note(th["effort_values"])) |
| 131 | - if len(values) > 1: | ||
| 132 | - n.append(f"Reasoning effort: chat_template_kwargs.reasoning_effort, one of {', '.join(values)}; a value the template does not know may make every request fail (Qwen3.8's raises).") | ||
| 133 | - else: | ||
| 134 | - n.append("Reasoning effort: chat_template_kwargs.reasoning_effort — the template names only its default" | ||
| 135 | - + (f" ({values[0]})" if values else "") + "; take the other values from the model card (gpt-oss: low, medium, high).") | ||
| 136 | if th["default"] and "always" in str(th["default"]): | 98 | if th["default"] and "always" in str(th["default"]): |
| 137 | n.append("The model always reasons: give max_tokens room for the reasoning plus a whole tool call (16384+).") | 99 | n.append("The model always reasons: give max_tokens room for the reasoning plus a whole tool call (16384+).") |
| 138 | if th["default"] in ("on",) or th["effort"]: | 100 | if th["default"] in ("on",) or th["effort"]: |
| 139 | n.append("With reasoning on, never use temperature 0.0 (thinking models loop); showThinking: true helps while tuning.") | 101 | n.append("With reasoning on, never use temperature 0.0 (thinking models loop); showThinking: true helps while tuning.") |
| 102 | + return n | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +def effort_note(values): | ||
| 106 | + """The reasoning_effort note: the values the template knows, or only its default.""" | ||
| 107 | + if len(values) > 1: | ||
| 108 | + return f"Reasoning effort: chat_template_kwargs.reasoning_effort, one of {', '.join(values)}; a value the template does not know may make every request fail (Qwen3.8's raises)." | ||
| 109 | + return ("Reasoning effort: chat_template_kwargs.reasoning_effort — the template names only its default" | ||
| 110 | + + (f" ({values[0]})" if values else "") + "; take the other values from the model card (gpt-oss: low, medium, high).") | ||
| 111 | + | ||
| 112 | + | ||
| 113 | +def tool_notes(fmt): | ||
| 114 | + """The notes on the tool-call format.""" | ||
| 115 | + n = [] | ||
| 140 | if fmt == "xml": | 116 | if fmt == "xml": |
| 141 | n.append("XML tool calls: llama.cpp builds a grammar from each tool schema and imposes NESTED object properties in alphabetical order — keep a custom/MCP tool's nested objects without `properties` (describe them in words) or the model loses fields.") | 117 | n.append("XML tool calls: llama.cpp builds a grammar from each tool schema and imposes NESTED object properties in alphabetical order — keep a custom/MCP tool's nested objects without `properties` (describe them in words) or the model loses fields.") |
| 142 | if fmt in ("json", "gemma", "harmony", "xml"): | 118 | if fmt in ("json", "gemma", "harmony", "xml"): |
| 143 | n.append("parallel_tool_calls: false — one call per reply; small models run tests before the edit lands otherwise.") | 119 | n.append("parallel_tool_calls: false — one call per reply; small models run tests before the edit lands otherwise.") |
| 120 | + return n | ||
| 121 | + | ||
| 122 | + | ||
| 123 | +def setup_notes(f, fmt): | ||
| 124 | + """The notes on sampling, the window, the identity line and the system message.""" | ||
| 125 | + n = [] | ||
| 144 | if not f["sampling_in_gguf"]: | 126 | if not f["sampling_in_gguf"]: |
| 145 | n.append("No sampling in the GGUF: use the model author's published recommendation.") | 127 | n.append("No sampling in the GGUF: use the model author's published recommendation.") |
| 146 | ctx = f["architecture"]["context_length"] | 128 | ctx = f["architecture"]["context_length"] |
added
skills/create-agent/template_facts.py +52 -0 | new file mode 100644 | ||
| @@ -0,0 +1,52 @@ | ||
| 1 | +"""What a chat template says about a model: its reasoning switches and how it writes a | |
| 2 | +tool call. Read by model_facts.py, from the template llmman's /api/show returns.""" | |
| 3 | + | |
| 4 | +import re | |
| 5 | + | |
| 6 | + | |
| 7 | +def thinking(template): | |
| 8 | + """How the template switches reasoning, and what it does by default.""" | |
| 9 | + t = template | |
| 10 | + out = {"variable": None, "default": None, "effort": None, "effort_values": [], "preserve_thinking": "preserve_thinking" in t} | |
| 11 | + if "enable_thinking" in t: | |
| 12 | + out["variable"] = "enable_thinking" | |
| 13 | + if re.search(r"enable_thinking\s*\|\s*default\(\s*false", t) or re.search(r"enable_thinking is defined and enable_thinking is true", t): | |
| 14 | + out["default"] = "off" | |
| 15 | + elif re.search(r"enable_thinking is defined and enable_thinking is false", t) or re.search(r"enable_thinking is undefined or enable_thinking is true", t): | |
| 16 | + out["default"] = "on" | |
| 17 | + if "reasoning_effort" in t: | |
| 18 | + out["effort"] = "reasoning_effort" | |
| 19 | + m = re.search(r"reasoning_effort\|default\(['\"](\w+)['\"]\)|set reasoning_effort = ['\"](\w+)['\"]", t) | |
| 20 | + if m: | |
| 21 | + out["effort_default"] = m.group(1) or m.group(2) | |
| 22 | + out["effort_values"] = sorted({v for v in re.findall(r"['\"](low|medium|high|xhigh|minimal|none)['\"]", t)}) | |
| 23 | + if out["variable"] is None: | |
| 24 | + out["default"] = "always on (graded by reasoning_effort)" | |
| 25 | + if out["variable"] is None and out["effort"] is None: | |
| 26 | + out["default"] = "reasons, no switch" if ("<think>" in t or "thought" in t) else "no reasoning" | |
| 27 | + return out | |
| 28 | + | |
| 29 | + | |
| 30 | +# How a chat template writes a tool call, checked in this order: the first | |
| 31 | +# test that holds names the format. | |
| 32 | +TOOL_FORMATS = [ | |
| 33 | + (lambda t: "<function=" in t, | |
| 34 | + ("xml", "Qwen3-Coder XML: <tool_call><function=name><parameter=key>value</parameter>…")), | |
| 35 | + (lambda t: "<|tool_call>call:" in t, | |
| 36 | + ("gemma", "Gemma 4 DSL: <|tool_call>call:name{key:<|\"|>value<|\"|>}<tool_call|>")), | |
| 37 | + (lambda t: "to=functions." in t or "to=\" }}" in t or "functions." in t and "<|channel|>commentary" in t, | |
| 38 | + ("harmony", "harmony: assistant to=functions.name <|channel|>commentary json<|message|>{…}<|call|>")), | |
| 39 | + (lambda t: "<tool_call>" in t and '"name"' in t, | |
| 40 | + ("json", "Hermes JSON: <tool_call>{\"name\": …, \"arguments\": {…}}</tool_call>")), | |
| 41 | + (lambda t: "[TOOL_CALLS]" in t, | |
| 42 | + ("mistral", "Mistral: [TOOL_CALLS]name[ARGS]{…}")), | |
| 43 | + (lambda t: "tools" in t, | |
| 44 | + ("other", "the template handles tools; read it with --template")), | |
| 45 | +] | |
| 46 | + | |
| 47 | + | |
| 48 | +def tool_format(template): | |
| 49 | + for matches, found in TOOL_FORMATS: | |
| 50 | + if matches(template): | |
| 51 | + return found | |
| 52 | + return "none", "the template has no tool support" | |
| new file mode 100644 | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | +"""What a chat template says about a model: its reasoning switches and how it writes a | ||
| 2 | +tool call. Read by model_facts.py, from the template llmman's /api/show returns.""" | ||
| 3 | + | ||
| 4 | +import re | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +def thinking(template): | ||
| 8 | + """How the template switches reasoning, and what it does by default.""" | ||
| 9 | + t = template | ||
| 10 | + out = {"variable": None, "default": None, "effort": None, "effort_values": [], "preserve_thinking": "preserve_thinking" in t} | ||
| 11 | + if "enable_thinking" in t: | ||
| 12 | + out["variable"] = "enable_thinking" | ||
| 13 | + if re.search(r"enable_thinking\s*\|\s*default\(\s*false", t) or re.search(r"enable_thinking is defined and enable_thinking is true", t): | ||
| 14 | + out["default"] = "off" | ||
| 15 | + elif re.search(r"enable_thinking is defined and enable_thinking is false", t) or re.search(r"enable_thinking is undefined or enable_thinking is true", t): | ||
| 16 | + out["default"] = "on" | ||
| 17 | + if "reasoning_effort" in t: | ||
| 18 | + out["effort"] = "reasoning_effort" | ||
| 19 | + m = re.search(r"reasoning_effort\|default\(['\"](\w+)['\"]\)|set reasoning_effort = ['\"](\w+)['\"]", t) | ||
| 20 | + if m: | ||
| 21 | + out["effort_default"] = m.group(1) or m.group(2) | ||
| 22 | + out["effort_values"] = sorted({v for v in re.findall(r"['\"](low|medium|high|xhigh|minimal|none)['\"]", t)}) | ||
| 23 | + if out["variable"] is None: | ||
| 24 | + out["default"] = "always on (graded by reasoning_effort)" | ||
| 25 | + if out["variable"] is None and out["effort"] is None: | ||
| 26 | + out["default"] = "reasons, no switch" if ("<think>" in t or "thought" in t) else "no reasoning" | ||
| 27 | + return out | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +# How a chat template writes a tool call, checked in this order: the first | ||
| 31 | +# test that holds names the format. | ||
| 32 | +TOOL_FORMATS = [ | ||
| 33 | + (lambda t: "<function=" in t, | ||
| 34 | + ("xml", "Qwen3-Coder XML: <tool_call><function=name><parameter=key>value</parameter>…")), | ||
| 35 | + (lambda t: "<|tool_call>call:" in t, | ||
| 36 | + ("gemma", "Gemma 4 DSL: <|tool_call>call:name{key:<|\"|>value<|\"|>}<tool_call|>")), | ||
| 37 | + (lambda t: "to=functions." in t or "to=\" }}" in t or "functions." in t and "<|channel|>commentary" in t, | ||
| 38 | + ("harmony", "harmony: assistant to=functions.name <|channel|>commentary json<|message|>{…}<|call|>")), | ||
| 39 | + (lambda t: "<tool_call>" in t and '"name"' in t, | ||
| 40 | + ("json", "Hermes JSON: <tool_call>{\"name\": …, \"arguments\": {…}}</tool_call>")), | ||
| 41 | + (lambda t: "[TOOL_CALLS]" in t, | ||
| 42 | + ("mistral", "Mistral: [TOOL_CALLS]name[ARGS]{…}")), | ||
| 43 | + (lambda t: "tools" in t, | ||
| 44 | + ("other", "the template handles tools; read it with --template")), | ||
| 45 | +] | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +def tool_format(template): | ||
| 49 | + for matches, found in TOOL_FORMATS: | ||
| 50 | + if matches(template): | ||
| 51 | + return found | ||
| 52 | + return "none", "the template has no tool support" | ||