fix(model): DeepSeek 推理参数语义反转 + thinking 开关真发(按官方文档核对结果)
依据 DevDocs/design/04 §3.2「官方核对后的修正」9 条 + 本地 DevDocs/reference/deepseek/facts-for-cyrene.md(官方原句/URL)。 - 🔴 reasoning_effort 白名单改为官方集合 [none, low, high, max] + 别名映射(minimal→low, medium→high, xhigh→high, ultra→max);**删除就近降级**,非法值一律丢弃+WARN。此前 none(关思考) 被降级成 low(开思考) 属语义反转 - 🔴 DeepSeek thinking 开关真发顶层 {"thinking":{"type":"enabled|disabled"}}(官方默认 enabled,不传≠关);此前只打 WARN 导致 mode:off 静默无效 - DeepSeek 的 /anthropic 端点忽略 budget_tokens → 不再对其抬 max_tokens(会误导预算/日志),改为按官方用 output_config.effort - 注释纠正:penalty 属接口级 deprecated(非仅思考模式);top_p 仅思考模式生效且下限 0.95(不加该字段) - tool_choice 雷登记:思考模式下 required/指定 tool 会 400(思考默认开) - 旧模型名清理(deepseek-chat/reasoner 已于 2026-07-24 停用) - 请求体级测试 + 变异验证(把 none 改回 low / 把 thinking 改回只 WARN → 对应断言 FAIL)
This commit is contained in:
1 parent
0624d9ee36
commit
0de68bc960
11 files changed
+1076
-149
No files matched your search
@@ -158,6 +158,15 @@ type Request struct {
|
||||
Model string
|
||||
Messages []Message
|
||||
// Temperature is the sampling temperature. nil means the provider default.
|
||||
//
|
||||
// DeepSeek notes (design/04 §3.2 facts 3 and 4): temperature takes no effect
|
||||
// while thinking is on. frequency_penalty and presence_penalty are deprecated
|
||||
// at the API level — "传入该参数将不会产生任何效果" — in every mode, which is
|
||||
// why Request has no field for them. top_p is deliberately not exposed
|
||||
// either: it only applies while thinking is on and is clamped to >= 0.95
|
||||
// there, is always 1.0 otherwise, so sending a configured value would be
|
||||
// silently ineffective on one side of the switch and a hard floor on the
|
||||
// other.
|
||||
Temperature *float64
|
||||
// MaxTokens caps the generated tokens. Zero means the provider default.
|
||||
MaxTokens int
|
||||
@@ -169,16 +178,28 @@ type Request struct {
|
||||
// opaque provider-agnostic directive (e.g. {"type":"auto"} or {"type":"tool",
|
||||
// "name":"x"}); empty means the provider default. Passed through verbatim to
|
||||
// protocols that support it (Anthropic's tool_choice).
|
||||
//
|
||||
// DeepSeek red line (design/04 §3.2 fact 5): with thinking on — its default —
|
||||
// a forcing directive ("required" / "any" / a named tool) is rejected with a
|
||||
// 400, so thinking must be switched off explicitly first. The adapters only
|
||||
// WARN about that combination; they never switch thinking off on their own.
|
||||
ToolChoice any
|
||||
// Thinking controls the provider's reasoning budget/switch (design/04 §3.2).
|
||||
// nil means "do not intervene" and uses the provider default. A provider
|
||||
// whose protocol has no mapping for it logs a WARN rather than silently
|
||||
// ignoring it.
|
||||
//
|
||||
// "Do not intervene" is not the same as "off": DeepSeek's thinking defaults to
|
||||
// enabled, so Enable=false is what closes it there (sent as
|
||||
// {"thinking":{"type":"disabled"}}).
|
||||
Thinking *Thinking
|
||||
// ReasoningEffort is the OpenAI-compatible reasoning strength knob
|
||||
// (reasoning_effort). Empty means "do not intervene". The value is validated
|
||||
// against the detected provider's whitelist; an unsupported value is
|
||||
// downgraded to the nearest allowed tier (or dropped) with a WARN.
|
||||
// against the detected provider's whitelist; an unrecognized value is dropped
|
||||
// with a WARN and never replaced by a different tier (design/04 §3.2 fact 1).
|
||||
// DeepSeek additionally documents compatibility aliases (minimal→low,
|
||||
// medium/xhigh→high, ultra→max), which are normalized to the tier the service
|
||||
// applies.
|
||||
ReasoningEffort string
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user