Commit ff81bc8
committed
fix(openai): restore adapter→builtin→override precedence in createModel
The merge order in createModel spread builtIn.compat first then this.compat,
so the adapter's generic default (maxTokensField: 'max_tokens') silently
clobbered the model-specific override that the built-in entry sets
('max_completion_tokens' for reasoning-capable models). Result: every
reasoning model loaded via createModel sent the wrong field name and OpenAI
returned 400 "Unsupported parameter: 'max_tokens'". Same bug applied to
headers. The mock-mode unit tests didn't catch it because the mocked fetch
never validated the request body — the live smoke test caught it on the
first real call.
Swap to: adapter defaults → built-in catalog → caller overrides, so the
most specific source wins. Adds two regression tests.1 parent f368197 commit ff81bc8
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
135 | 149 | | |
136 | 150 | | |
137 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
393 | | - | |
| 392 | + | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| |||
0 commit comments