きしだൠ(K1S)@kis
To run GLM-5.2 on @lmstudio , the chat template can't be parsed since it uses namespace.
Use this template insteed.
---
[gMASK]
{%- set enable_thinking=true -%}
{%- set reasoning_effort = 'max' -%}
{%- set effective_reasoning_effort = 'high' if reasoning_effort is defined and reasoning_effort == 'high' else 'max' -%}
{%- if (enable_thinking is not defined or enable_thinking) and effective_reasoning_effort is not none -%}<|system|>Reasoning Effort: {{ effective_reasoning_effort | capitalize }}{%- endif -%}
{%- if tools -%}
{%- macro tool_to_json(tool) -%}
{%- set filtered = [] -%}
{%- for k, v in tool.items() -%}
{%- if k != 'defer_loading' and k != 'strict' -%}
{%- set _ = filtered.append('"' ~ k ~ '": ' ~ v | tojson(ensure_ascii=False)) -%}
{%- endif -%}
{%- endfor -%}
{{- '{' }}{{ filtered | join(', ') }}{{ '}' -}}
{%- endmacro -%}
<|system|>
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within XML tags:
{% for tool in tools %}
{%- if tool is not none and tool is mapping and 'function' in tool -%}
{%- set tool = tool['function'] -%}
{%- endif -%}
{% if tool.defer_loading is not defined or not tool.defer_loading %}
{{ tool_to_json(tool) }}
{% endif %}
{% endfor %}
For each function call, output the function name and arguments within the following XML format:
{function-name}{arg-key-1}{arg-value-1}{arg-key-2}{arg-value-2}...{%- endif -%}
{%- macro visible_text(content) -%}
{%- if content is string -%}
{{- content }}
{%- elif content is iterable and content is not mapping -%}
{%- for item in content -%}
{%- if item is mapping and item.type == 'text' -%}
{{- item.text }}
{%- elif item is string -%}
{{- item }}
{%- elif item is mapping and item.type in ['image', 'image_url', 'video', 'video_url', 'audio', 'audio_url', 'input_audio'] -%}
{%- set media_type = item.type | replace('_url', '') | replace('input_', '') -%}
{{- "You are unable to process this " ~ media_type ~ " because you don't have multi-modal input ability. Try different methods." }}
{%- endif -%}
{%- endfor -%}
{%- else -%}
{{- content }}
{%- endif -%}
{%- endmacro -%}
{%- set last_user_index = -1 -%}
{%- for m in messages -%}
{%- if m is not none and m is mapping and m.role == 'user' -%}
{%- set last_user_index = loop.index0 -%}
{%- endif -%}
{%- endfor -%}
{%- for m in messages -%}
{%- if m is not none and m is mapping and m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
{%- elif m.role == 'assistant' -%}
<|assistant|>
{%- set content = visible_text(m.content) -%}
{%- set reasoning_content = none -%}
{%- if m.reasoning_content is defined and m.reasoning_content is string -%}
{%- set reasoning_content = m.reasoning_content -%}
{%- elif '' in content -%}
{%- set reasoning_content = content.split('')[0].split('')[-1] -%}
{%- set content = content.split('')[-1] -%}
{%- endif -%}
{%- if ((clear_thinking is defined and not clear_thinking) or loop.index0 > last_user_index) and reasoning_content is not none -%}
{{ '' + reasoning_content + '' }}
{%- else -%}
{{ '' }}
{%- endif -%}
{%- if content.strip() -%}
{{ content.strip() }}
{%- endif -%}
{% if m.tool_calls %}
{% for tc in m.tool_calls %}
{%- if tc.function %}
{%- set tc = tc.function %}
{%- endif %}
{{- '' + tc. name -}}
{% set _args = tc.arguments %}{% for k, v in _args.items() %}{{ k }}{{ v | tojson(ensure_ascii=False) if v is not string else v }}{% endfor %}{% endfor %}
{% endif %}
{%- elif m.role == 'tool' -%}
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
{{- '<|observation|>' -}}
{%- endif %}
{%- if m.content is string -%}
{{- '' + m.content + '' -}}
{%- elif m.content is iterable and m.content is not mapping and m.content and m.content[0].type == "tool_reference" -%}
{{- '\n' -}}
{% for tr in m.content %}
{%- for tool in tools -%}
{%- if tool is not none and tool is mapping and 'function' in tool -%}
{%- set tool = tool['function'] -%}
{%- endif -%}
{%- if tool is not none and tool is mapping and tool. name == tr. name -%}
{{- tool_to_json(tool) + '\n' -}}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{{- '' -}}
{%- elif m.content is iterable and m.content is not mapping and m.content and m.content[0] is mapping and m.content[0].output is defined -%}
{%- for tr in m.content -%}
{{- '' + tr.output + '' -}}
{%- endfor -%}
{%- else -%}
{{- '' + visible_text(m.content) + '' -}}
{% endif -%}
{%- elif m.role == 'system' -%}
<|system|>{{ visible_text(m.content) }}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
<|assistant|>{{- '' if (enable_thinking is defined and not enable_thinking) else '' -}}
{%- endif -%}