Replies: 2 comments
|
Real-world validation of exactly this gap, from a deployment hitting it today: Setup: hand-declared route Symptom: once the model is reasoning-enabled, every request fails upstream with Interim local fix (until this lands upstream): patched This confirms the branch |
|
先给 @yannicksong0106 一条今天就能解掉那个 400 的办法,然后说这对本提案意味着什么。 这两个开关在 rc.8 的 profile schema 里已经存在了@yannicksong0106 被 llm-pi-ai:
providers:
amazon-bedrock:
api: openai-completions
baseURL: https://llmhost.net/v1
apiKeyEnv: ...
models:
- id: deepseek-v4-flash
reasoningEfforts: { off:, low: low, high: high }
compat:
supportsDeveloperRole: false # ← 就是这一行证据(不是读类型推的,是在真 DSH loop 上打到线上的):我们有一个专门验这件事的 example,用的是透传录制代理——请求真发给上游、响应真流回来,中间只多存一份请求体。录到的 body 里 边界要说清:我验的是模型条目(entry)级的 对提案的意义:可能得先确认它还没被合掉我这边有一条间接但挺硬的证据:我们做 DSH 的兼容层,需要把 Pi 侧的 compat 声明翻译成 DSH 的 profile 字段,为了防止上游加字段时我们悄悄漏掉,那张映射表钉了一个编译期门: const DSH_COMPAT_FIELD_PROTOCOLS = {
supportsDeveloperRole: COMPLETIONS_AND_RESPONSES,
requiresReasoningContentOnAssistantMessages: COMPLETIONS,
// …其余十几个
} satisfies Record<keyof PiAiCompatProfile, ReadonlySet<string>>
所以建议你先做一件很便宜的事:对着当前 rc.8 的
不管是哪种,先确认再推进比带着一个可能已经过时的分支等 PR 通道划算。 顺带说一句:你"为什么用配置而不是扩展自动探测"那段是对的
这一点我们踩过并且立了内部规矩:翻译 provider 时显式写入 compat,不走 (@yannicksong0106 那条实测正好是这句话的注脚:目录路由没事是因为 pi-ai 的 catalog 给已知网关钉了 边界与利益相关我们不修 DSH 自家组件—— 利益相关:我维护 pi2dsh(Pi 生态兼容层),上面那个录制代理和 example 是它的验收装置。这条不推销:第一节那段 YAML 是纯 DSH 官方配置,不需要装我们任何东西;我们只是因为要翻译这些字段,所以对它们在不在 schema 里格外敏感。 |
Uh oh!
There was an error while loading. Please reload this page.
Contribution: expose OpenAI-completions compat switches for hand-declared llm-pi-ai routes
This is a small, tested contribution waiting for a merge channel. PRs are currently disabled on this repository, so I'm posting it here — the branch is ready and can be opened as a PR the moment the repository accepts them.
Branch:
exposir/deepseek-harness:feat/llm-pi-ai-compat-switches(3 commits, +101/−3, based on currentmaster)Problem
Hand-declared
llm-pi-airoutes to OpenAI-completions gateways inherit compatibility behavior from pi-ai's baseURL-derived auto-detection, which only recognizes first-party endpoints. Two real gateways break because of this:https://opencode.ai/zen/go/v1) enforces thinking replay: a later request whose thinking-mode assistant messages omitreasoning_contentis rejected withINVALID_REQUEST. Auto-detection does not recognize the endpoint, so multi-turn requests fail.https://api.kimi.com/coding/v1) rejects thedevelopermessage role and only acceptssystem. Auto-detection defaultssupportsDeveloperRoleto true for unknown gateways, so requests carrying a developer message fail.Change
Expose the two existing
OpenAICompletionsCompatswitches throughPiAiCompatProfile, mirroring the establishedthinkingFormat/supportsReasoningEffortpattern:requiresReasoningContentOnAssistantMessagessupportsDeveloperRoleSemantics match the existing switches exactly: an entry-level value wins per field over the route-level value, an absent value keeps the catalog's own compat (then pi-ai's baseURL-derived guess), and setting the switch on a route whose api is not
openai-completionsfails loud.Why configuration instead of extending auto-detection
Auto-detection can only enumerate first-party endpoints; third-party gateways with different replay/role conventions cannot be closed over. The config switch is the sustainable surface for hand-declared routes, consistent with the two compat switches already exposed.
Tests
catalog.spec.ts: both switches reach every openai-completions model per route with entries winning per field; a thinking-replay switch on a non-completions protocol fails loud.config.spec.ts: both switches accept booleans and reject other values.Verified with
pnpm run gen-config-catalog/verify-config-catalog; the full llm-pi-ai catalog + config suites pass (63 tests). Happy to adapt anything per maintainer feedback.All reactions