Skip to content

feat(openai-compat): thinking/reasoning_content 双向透传与 reasoning_effort - #6

Open
jk-uzi wants to merge 2 commits into
dengyie:mainfrom
jk-uzi:feat/compat-thinking
Open

jk-uzi wants to merge 2 commits into
dengyie:mainfrom
jk-uzi:feat/compat-thinking

Conversation

@jk-uzi

@jk-uzi jk-uzi commented Oct 4, 2026

Copy link
Copy Markdown

概述

OpenAI 兼容层支持思考内容双向透传与推理强度参数。

细节

  • 请求侧:历史轮 reasoning_content(含 reasoning / reasoning_text 别名)→ Anthropic thinking 块(上游对 signature 不校验,实测伪造值可通过,空串亦可)
  • 请求侧:reasoning_effort ∈ {low, high, max} → body.reasoning_effort(上游 GLM-5.3 系原生接受;off/none 不带该字段,交给默认档)
  • 响应侧:thinking 块文本聚合进 message.reasoning_content(pi-ai / DeepSeek 风格均可识别)
  • 流式:content_block_start / content_block_delta 的 thinking 事件映射为 reasoning_content 增量 chunk
  • 新增 125 行单测覆盖非流式与流式路径

测试

  • 本地全量 pytest 通过

jk-uzi added 2 commits October 4, 2026 14:56
- 请求侧:历史轮 reasoning_content → Anthropic thinking 块(signature 空串可过);
  reasoning_effort low/high/max 透传上游,其余值不带(上游不支持关思考)
- 响应侧:thinking 块聚合为 message.reasoning_content(DeepSeek/pi-ai 风格)
- 流式:thinking_delta → reasoning_content 增量 chunk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant