Tabbit
活动资源博客模型
Tabbit LogoTabbit

Tabbit — 为你工作的 AI 浏览器

主题资源

  • AI Browser Resources
  • Agentic Browser Resources
  • Browser Downloads and Install Guides
  • Browser Comparisons
  • AI Browser Alternatives
  • Browser Productivity Resources

热门指南

  • AI Browser
  • Agentic Browser Download
  • Best AI Browser 2026: Top 9 Tested & Ranked
  • AI Browser Download
  • Free AI Browser
  • Best AI Browser 2026
  • AI Browser Comparison 2026
  • AI Browser for Windows
  • AI Browser for Mac
  • Chrome Alternative 2026

活动

  • 别装了,你在《牛来》里早有原型
  • Tabbit 妙招大赛
  • KPOP SBTI 饭圈人格测试
  • Tabbit 校园共创者计划
  • fifi 的论文文献妙招精选
  • 用户问卷

关于

  • Tabbit 博客
  • 媒体报道
提示词
媒体GLM-5.2

GLM-5.2 思考模式配置:默认思考 / 交错思考 / 保留思考 / 回合级思考(官方)

原始来源

Z.ai 官方开发者文档(docs.z.ai,Capabilities / Thinking Mode)

作者Z.ai(智谱国际)

Tabbit 整理2026-08-19

查看原文

一句话结论

官方说明 GLM-5.2 思考默认开启(与 GLM-5.1/5/4.7 一致),提供四种思考形态——默认思考、交错思考(工具调用之间思考)、保留思考(跨轮保留推理内容,clear_thinking: false)、回合级思考(每回合独立开关),并给出"必须把历史 reasoning_content 原样回传"的 Agent 集成关键约束。

适用场景

  • 适合的任务:构建工具调用型 Agent(需要在每次工具结果后继续推理);追求长会话一致性与缓存命中率的编码/Agent 产品(保留思考);需要按回合精细控制成本与延迟的多轮应用(回合级思考)。

  • 不适合的任务:无法或不愿回传完整 reasoning_content 的会话系统(会破坏保留思考并降低性能与缓存命中);对思考内容有隐私/合规顾虑的转发层(思考默认开启且不可在不改变行为的前提下全局关闭)。

  • 适用的模型版本:GLM-5.2、GLM-5.1、GLM-5、GLM-4.7(思考默认开启);GLM-4.6 为混合思考默认,行为不同。

  • 适用的客户端、Agent 或 API:Z.ai Chat Completions API;GLM Coding Plan 端点(保留思考默认开启);标准 API 端点(保留思考默认关闭,需显式 "clear_thinking": false 开启)。

  • 推荐的推理档位和参数:思考默认开启;thinking.type 支持 enabled / disabled;Agent 场景建议 "clear_thinking": false(保留思考)并回传完整未修改的 reasoning_content;轻量回合可用 thinking.type: disabled 换取更快响应。

可直接使用的内容

关闭思考(官方写法)

"thinking": {
    "type": "disabled"
}

保留思考(Preserved Thinking)配置要点

  • 在编码/Agent 场景下推荐开启;Coding Plan 端点默认开启,标准 API 端点默认关闭。

  • 开启方式(API 端点):"clear_thinking": false。

  • 必须把完整的、未经修改的 reasoning_content 回传给 API;所有连续的 reasoning 块必须与模型最初生成时的顺序完全一致,不能重排或编辑,否则性能下降、缓存命中率受影响。

  • 作用:保留上一轮 assistant 的推理内容到上下文中,维持推理连续性、提升性能、提高缓存命中率从而节省 token。

交错思考(Interleaved Thinking)+ 工具调用完整示例(官方)

"""Interleaved Thinking + Tool Calling Example"""

import json
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.z.ai/api/paas/v4/",
)

tools = [{"type": "function", "function": {
    "name": "get_weather",
    "description": "Get weather information",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
}}]

messages = [
    {"role": "system", "content": "You are an assistant"},
    {"role": "user", "content": "What's the weather like in Beijing?"},
]

# Round 1: the model reasons and then calls a tool
response = client.chat.completions.create(model="glm-5.2", messages=messages, tools=tools, stream=True, extra_body={
        "thinking":{
        "type":"enabled",
        "clear_thinking": False  # False for Preserved Thinking
    }})
reasoning, content, tool_calls = "", "", []
for chunk in response:
    delta = chunk.choices[0].delta
    if hasattr(delta, "reasoning_content") and delta.reasoning_content:
        reasoning += delta.reasoning_content
    if hasattr(delta, "content") and delta.content:
        content += delta.content
    if hasattr(delta, "tool_calls") and delta.tool_calls:
        for tc in delta.tool_calls:
            if tc.index >= len(tool_calls):
                tool_calls.append({"id": tc.id, "function": {"name": "", "arguments": ""}})
            if tc.function.name:
                tool_calls[tc.index]["function"]["name"] = tc.function.name
            if tc.function.arguments:
                tool_calls[tc.index]["function"]["arguments"] += tc.function.arguments

print(f"Reasoning: {reasoning}\nTool calls: {tool_calls}")

# Key: return reasoning_content to keep the reasoning coherent
messages.append({"role": "assistant", "content": content, "reasoning_content": reasoning,
                 "tool_calls": [{"id": tc["id"], "type": "function", "function": tc["function"]} for tc in tool_calls]})
messages.append({"role": "tool", "tool_call_id": tool_calls[0]["id"],
                 "content": json.dumps({"weather": "Sunny", "temp": "25°C"})})

# Round 2: the model continues reasoning based on the tool result and responds
response = client.chat.completions.create(model="glm-5.2", messages=messages, tools=tools, stream=True, extra_body={
        "thinking":{
        "type":"enabled",
        "clear_thinking": False # False for Preserved Thinking
    }})
reasoning, content = "", ""
for chunk in response:
    delta = chunk.choices[0].delta
    if hasattr(delta, "reasoning_content") and delta.reasoning_content:
        reasoning += delta.reasoning_content
    if hasattr(delta, "content") and delta.content:
        content += delta.content

print(f"Reasoning: {reasoning}\nReply: {content}")

回合级思考(Turn-level Thinking)要点

  • 同一会话内每次请求可独立选择开启/关闭思考。

  • 轻量回合(查事实、改措辞)关思考换取更快响应;重任务(复杂规划、多约束推理、代码调试)开思考提升准确性与稳定性。

  • Agent/工具场景:需要快速执行工具的回合降低推理开销,需要基于工具结果决策的回合加深思考。

  • 多轮中模型保持连贯与一致的输出风格。

注意与边界

  • 官方文档示例代码中的 model="glm-4.7" 为文档通用示例写法,同一页明确说明思考默认开启行为适用于 GLM-5.2 系列;接入 GLM-5.2 时应改为 model="glm-5.2"。

  • 保留思考的"必须原样回传 reasoning_content"约束对转发层/中间缓存是硬性要求,若不满足会直接损害效果。

Tabbit 小编提醒

提示词内容来自公开资料与 Tabbit 编辑整理。引用前请查看原文授权与适用范围。

GLM-5.2

在 Tabbit 中使用

GLM-5.2

相关提示词

媒体Z.ai 官方开发者文档(docs.z.ai)2026-06-16

GLM-5.2 官方文档 Overview 与 API 快速开始(docs.z.ai)

媒体Z.ai 官方开发者文档(docs.z.ai,Get Started / Migrate)2026-06

从 GLM-5.1 / GLM-5 / GLM-4.x 迁移到 GLM-5.2 的官方配置指南

社区X.com(Twitter),@arena(Arena.ai 官方账号)2026-06-27

Arena.ai 前端编码同题对比:GLM-5.2 (Max) vs Claude Opus 4.8 (Thinking) 的 10 个单次生成示例

媒体rentry.org(作者自建提示词库,由 SillyTavernAI 社区推荐)2026-08-07

GLM-5.2 角色扮演(RP)系统提示词:Evening-Truth 黑暗版完整提示词

GLM-5.2

相关测评

官方Z.ai 官方博客2026-06-16

GLM-5.2 官方发布说明与完整跑分表(Z.ai 博客)

媒体NIST(美国国家标准与技术研究院)官网新闻2026-07-17

NIST CAISI 对 Z.ai GLM-5.2 的独立能力评估

媒体rentry.org(作者个人提示词库的说明页)2026-03-09

Evening-Truth 对 Z.AI Coding Plan 响应质量的投诉与量化疑云

媒体Hugging Face 官方博客(Security incident disclosure)2026-07

Hugging Face 安全事件取证:GLM-5.2 被用于自托管攻击日志分析(真实项目报告)