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 博客
  • 媒体报道
简体中文
简体中文English
提示词与工作流

GLM-5.2 · configuration

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

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

来源待核验GLM-5.2 tool-calling conversation

前置条件与输入

  • reasoning_content history
  • clear_thinking
  • turn policy
  • tool result

完整可复制模板

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

Tabbit 编辑改写;非来源原文
用 {{多轮任务}} 测试 {{思考模式}};按顺序回传 {{推理字段}} 和 {{工具结果}},记录 {{清理思考}},核对 {{最终答案}}。

运行前仍需替换: {{多轮任务}}, {{思考模式}}, {{推理字段}}, {{工具结果}}, {{清理思考}}, {{最终答案}}

固定一组多轮工具任务,分别测试默认、交错、保留和回合级 thinking。每轮按要求原样回传 reasoning_content,记录 clear_thinking、tool result 和最终答案;如果状态丢失,先检查消息顺序再降低任务复杂度。

查看来源研究笔记

一句话结论

官方说明 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"约束对转发层/中间缓存是硬性要求,若不满足会直接损害效果。

来源与日期

Z.ai 官方开发者文档(docs.z.ai,Capabilities / Thinking Mode) · 原文日期: 未公开 · 编辑日期: 2026-09-20

阅读原始来源
变量检查

仍需替换: 6

{{多轮任务}}{{思考模式}}{{推理字段}}{{工具结果}}{{清理思考}}{{最终答案}}

相关提示词

GLM-5.2 官方文档 Overview 与 API 快速开始(docs.z.ai)从 GLM-5.1 / GLM-5 / GLM-4.x 迁移到 GLM-5.2 的官方配置指南通过 Mistral 平台使用 GLM-5.2(zai-glm-5-2):第三方托管配置与定价GLM-5.2 角色扮演(RP)系统提示词:Evening-Truth 黑暗版完整提示词

相关测评

NIST CAISI 对 Z.ai GLM-5.2 的独立能力评估Semgrep IDOR 基准:GLM-5.2 在安全代码审计中的裸提示词结果GLM-5.2 官方发布说明与完整跑分表(Z.ai 博客)Reddit 盲代码评审:GLM-5.2 的生产就绪评分与多裁判复核

模型深度阅读

总览 · 简体中文

GLM-5.2 是什么:价格、部署与适用边界

说明 GLM-5.2 的 2026 年 6 月发布、1M 上下文、开源权重、API 计费、编码证据与安全试用边界。

GLM-5.2

在 Tabbit 中使用 GLM-5.2

请在上方所列环境中运行本指南。下载不会自动传入模板,也不代表账户已开放该模型。