Replies: 2 comments
|
让推断的 supportsDeveloperRole 可配置很合理——手写 provider 路由时开发者应该能显式声明,而不是靠推断。 developer role 兼容问题我们 FAQ 记录过(#280/#614 同族:网关不认 developer role 时配 compat.supportsDeveloperRole: false):https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/faq.md |
|
谢谢线索。顺着 FAQ 里的编号往下看之后,我得更正自己开帖时的说法——这件事社区已经有人做过,而且早于本帖,在先的工作应该记在他们名下:
那本帖还剩什么:形态。它只加一个开关而非九个,理由按 另外一个善意提醒:那份 FAQ 目前写的"网关不认 developer role 时配 Correcting my own opening post: this was done in the community before I filed it, and the credit belongs upstream of this thread. #280 (2026-08-13, 7 upvotes) is the earlier and better-scoped request — its reports cover Volcano Coding Plan, newapi/Opencode Go, and DashScope's official OpenAI-compatible endpoint, so the blast radius is wider than the "private gateway" framing I used. What remains here is shape: one switch rather than nine, justified against the evidence bar |
Uh oh!
There was an error while loading. Please reload this page.
CONTRIBUTING.mdsays external pull requests cannot be accepted right now, so this is filed here instead. A working patch exists on a fork if it is useful; otherwise the report alone should be enough to reproduce.The gap
llm-pi-ailets a profile configurecompat.thinkingFormatandcompat.supportsReasoningEffortfor a hand-declared route, but not the third switch pi-ai infers the same way. In@earendil-works/pi-ai,openai-completions.js:1148computes:isNonStandardmatches only a short host list (nvidia, cerebras, xai, together, chutes, deepseek.com, zai, moonshot, opencode, cloudflare, ant-ling). A private gateway is never on it, so the switch inferstrue, andopenai-completions.js:787-788then sends the system prompt under thedevelopermessage role for any model whose descriptor hasreasoning.An OpenAI-compatible gateway whose backend accepts only
user/assistant— a Bedrock-fronting corporate gateway, for one — therefore rejects every request withUnexpected role "developer"as soon as a model on that route declares anyreasoningEfforts. The only way to keep the route usable today isreasoningEfforts: false, which forfeits all selectable thinking levels for a reason unrelated to what the model can do: the same gateway acceptsreasoning_effort, and accepts it alongside function tools.Worth noting for anyone trying to reproduce: a curl probe against such a gateway passes. The role is chosen inside pi-ai from the model's
reasoningflag and the endpoint URL, not by any field in a hand-written request, so only an assembled run shows the failure.The patch
A third switch,
supportsDeveloperRole, onPiAiCompatProfile, resolving on exactly the path the two existing switches use — model entry → route → installed catalog entry → pi-ai's URL-derived guess — and under the same openai-completions-only rule.falsekeeps system prompts onsystem.The rest of pi-ai's compat surface (
supportsStore,maxTokensField, …) stays auto-detected and unconfigurable, per the evidence bar inpackages/AGENTS.md: a switch is exposed only where a private gateway's URL provably misleads the inference.One vocabulary change comes with it. The block holds compat switches, not "reasoning-dispatch switches" — a message role is not reasoning dispatch — so the two rejection diagnostics now say
compat switchesinstead of enumerating field names, anddefinesCompatSwitchcollapses the condition that the model-level and route-level refusals each spelled out separately. Those two diagnostic strings change text; they are load-time only, with no wire or durable role.Touched:
packages/llm/llm-pi-ai/src/catalog.ts,src/config.ts,tests/catalog.spec.ts,tests/adapter.spec.ts, both READMEs, regenerateddocs/config-catalog{,.zh}.mdplus i18n pairing records, and an Agent Note triplet at.agents/notes/implemented/feature/2026-08-14-pi-ai-developer-role-compat-switch.md.Verification:
vitest run packages/llm/llm-pi-ai(215 passing), 100% statements/branches/functions/lines for the package,typecheck,lint, anddoc-sync(28/28). The adapter tests pin both wire outcomes against the mock server — pi-ai's inferreddeveloperrole on an unrecognized host, andsystemundersupportsDeveloperRole: falsewhilereasoning_effortstill goes out — so the switch is proven not to be a no-op. Fulltest:coverageand the snapshot suite were not run: the adapter mounts dormant in shipped compositions, socompatis off the default path.Real-gateway check: with the route declaring six
reasoningEffortslevels for a reasoning model, a headless task with a bash tool call atreasoningEffort: highsucceeded — the exact combination that previously failed onUnexpected role "developer". That gateway is on a private network, so it cannot back a CI assertion and no e2e test claims it.Branch: https://github.com/lyccol/deepseek-harness/tree/feat/pi-ai-developer-role-compat
Diff against master: master...lyccol:feat/pi-ai-developer-role-compat
Take it, rewrite it, or ignore it — the report is the part that matters.
中文
CONTRIBUTING.md写明目前不接受外部 PR,故发在这里。补丁已在 fork 上,可用则取,不可用的话仅凭上面的复现说明也足够。问题:
llm-pi-ai允许手工声明的路由配置compat.thinkingFormat与compat.supportsReasoningEffort,但 pi-ai 以同样方式推断的第三个开关不可配置。openai-completions.js:1148对不在其非标准主机名单(nvidia、cerebras、xai、together、deepseek.com 等)内的主机一律推断supportsDeveloperRole: true,于是:787-788会把任何具备reasoning的模型的系统提示放到developer角色下发送。私有网关永远不在名单里,因此一个与 OpenAI 兼容、但后端只允许user/assistant的网关(例如前置 Bedrock 的公司网关),只要路由上的模型声明了任何reasoningEfforts,每次请求都会以Unexpected role "developer"被拒。当前唯一可用姿态是reasoningEfforts: false——为一个与模型能力无关的原因放弃全部可选思考档位,而该网关本身既接受reasoning_effort,也接受它与 function tools 同时出现。用 curl 探测会通过:角色是 pi-ai 依据模型reasoning标志与 URL 在内部选定的,只有装配完成的真实运行才暴露。补丁:
PiAiCompatProfile增加supportsDeveloperRole,解析顺序与前两个开关完全一致(模型条目 → 路由 → 已安装 catalog 条目 → pi-ai 按 URL 的猜测),同受「仅openai-completions」约束;compat面其余部分保持自动检测且仍不开放,符合packages/AGENTS.md的证据门槛。随之把该块措辞从「reasoning-dispatch switches」泛化为「compat switches」(消息角色不属于推理分派),两条加载期诊断不再逐个列出字段名,definesCompatSwitch收拢了模型级与路由级此前各写一遍的同一条件。按分类,这在上游应是
kind/feature+area/llm。🤖 Generated with Claude Code
All reactions