|
标题:DSH 使用自定义中转站时,DeepSeek V4 推理模型在工具调用轮次必现 400 环境
复现步骤
实际结果本轮运行失败 400: 对比测试同一中转站、同一配置下,切换模型为 gpt-5.6-terra,工具调用正常。只有 DeepSeek V4 系列在开启思考模式并调用工具时必现 400。 推测原因DSH 在序列化包含 tool_calls 的 assistant 历史消息时,可能丢弃了 reasoning_content 字段,导致中转站校验失败。非推理模型不受影响。 已尝试的兼容配置(均无效)compat: 附件
|
Replies: 2 comments 2 replies
|
先回答最关键的一点:你列的五个 key 里有一个不存在 ——
重要的是:未知的 compat key 不是被静默忽略的。 放置位置: 关于你的推测(带 建议的下一步(一条就够):把出站请求体抓下来。我没在仓库里找到 DSH 自带的"打印出站请求体"开关(搜了 原因是你手上那条 400 的 body 没有信息量: 顺带一个可能更省事的方向:不要手写路由,把路由名直接命名成 |
|
I could not reproduce this as a 1. The reasoning text does reach the wireTwo-turn replay: turn 1 the relay answers with thinking + a tool call; turn 2 is the round you say 400s. Recorded bodies:
So the durable thinking text is preserved in the request. What varies is which key carries it — and which key your relay insists on. 2. One entry in your compat list is not a real switch
Remove that key first, then re-test — it makes the whole compat block untrustworthy, because with it present none of the other four switches was ever being exercised. (I checked it on your own version; the installed 3.
|
感谢您的指导。我通过本地 Fiddler 代理成功抓到了触发 400 错误的完整出站请求体,附件是脱敏后的
6_Request.json。同时,我定位到了问题的根本原因并成功修复了它。
原来 DSH 在请求时默认发送了
max_completion_tokens和store这两个字段,但我的中转站(以及可能其他 OpenAI 兼容网关)严格校验了这些字段,一旦发送就会返回 400。之前中文报错而英文hello不报错,大概率是因为中文上下文触发中转站更严格的格式检查。修复方法:在
settings.yaml的llm-pi-ai.providers.s1.compat配置下,加上这两行就完全解决了:附件
6_Request.json(脱敏后的出站请求体)