Reasoning effort is the dashboard's to set, not the client's
One model is loaded at a time under one setting, and that setting belongs next to the model it applies to -- the same reason the client can't switch models. So the proxy now takes a client's reasoning settings off the request before applying the dashboard's: a top-level reasoning_effort, and enable_thinking or reasoning_effort inside chat_template_kwargs. Other template kwargs, which llm-host has no opinion about, still pass through. This reverses the precedence the proxy had (a client's own kwargs won, mirroring mlx_lm's own rule), which was the wrong model for a single-model server: clients offer a generic menu -- opencode's low/medium/high -- and a level the template doesn't define makes it raise, so every request failed with nothing on the user's screen to explain it. - opencode: the provider block disables all three of opencode's effort levels instead of curating them. A chooser there would be a menu that does nothing. - Deletes the nearest-effort mapping (EFFORT_SCALE, nearest_effort, plan.effort_levels, the effort_levels= parameter through both backends): it existed only to rescue a client-supplied level, and none survives now. - plan.REASONING_KEYS names the knobs this server drives, with a test asserting it stays exactly equal to what reasoning_kwargs can emit -- so a new template knob can't be added without also taking it away from clients. - Two strings that still described a menu of models, from before the block held a single entry. Verified against the live MLX server: with the dashboard on xhigh, five request shapes (nothing, enable_thinking: false, effort low top-level, effort low in kwargs, and the off-scale "turbo" that used to 404) all answer identically, and the reply tracks the dashboard alone as it moves off / low / xhigh. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e48517b1cf
commit
e24c0b7712
10 changed files with 134 additions and 151 deletions
33
README.md
33
README.md
|
|
@ -95,13 +95,13 @@ alias, and `/v1/models` reports the real slug. The local entry is labelled with
|
|||
`llmhost switch`, the dashboard and `llmhost update` keep that label current. A config that still points at a
|
||||
specific model (`llmhost/qwen3.8-27b`) is migrated to `llmhost/default` the next time llm-host writes the block.
|
||||
|
||||
opencode offers its own `low`/`medium`/`high` effort menu for any reasoning model, and a level the model's
|
||||
template doesn't define makes every request fail. So the block carries `variants` that hide the levels the
|
||||
loaded model lacks and add the ones it has (Qwen3.8 27B: no `high`, plus `xhigh`). A pasted remote block can't
|
||||
follow a later switch, so the proxy also maps a level the model lacks to the nearest one it has (`high` →
|
||||
`xhigh`); a stale menu entry still works.
|
||||
opencode offers its own `low`/`medium`/`high` effort menu for any reasoning model, so the block carries
|
||||
`variants` that switch all three off. The effort level is set on the dashboard, next to the model it applies
|
||||
to, and the proxy drops whatever a client sends — a chooser in the client would be a menu that silently does
|
||||
nothing, listing levels the loaded model's template may not even define.
|
||||
|
||||
To serve a different model, switch the server: `llmhost switch <name>` or the dashboard. Clients don't choose.
|
||||
Neither the model nor its reasoning setting is the client's to choose: both change on the dashboard (or with
|
||||
`llmhost switch <name>`), because one model is loaded at a time and one setting applies to it.
|
||||
|
||||
Which block belongs to *this* machine is decided by the key-file reference it carries, not by its name. So the
|
||||
provider is still recognised after you rename it, a remote provider that happens to sit under the `llmhost` id is
|
||||
|
|
@ -140,12 +140,16 @@ Ornith 1.5 9B takes only `enable_thinking`. So the dashboard builds the chooser
|
|||
model's own template, with the level names from `catalog.json` (`"effort": {"levels": [...]}`) —
|
||||
a level the template doesn't know is never offered or sent.
|
||||
|
||||
The setting is a default for requests that don't ask for anything: the proxy adds it to chat
|
||||
completions, and a `chat_template_kwargs` key the client sets itself always wins. Changing it
|
||||
takes effect on the next request with no reload, so the model stays in memory.
|
||||
The dashboard is the only place it is set. The proxy puts the setting on every chat completion
|
||||
and takes the client's own out first — both a top-level `reasoning_effort` and `enable_thinking`
|
||||
or `reasoning_effort` inside `chat_template_kwargs`. Template kwargs llm-host has no opinion
|
||||
about are passed through untouched. Changing the setting takes effect on the next request with no
|
||||
reload, so the model stays in memory.
|
||||
|
||||
This works the same on vLLM and MLX. A client's own top-level `reasoning_effort` also wins over
|
||||
the dashboard's level, and one the model lacks is mapped to the nearest level it has.
|
||||
Clients are ignored here rather than obeyed because one model is loaded at a time under one
|
||||
setting, and because a client's menu is generic: opencode offers `high`, which Qwen3.8's template
|
||||
raises on, and the user would see every request fail with nothing on their screen to explain it.
|
||||
This works the same on vLLM and MLX.
|
||||
|
||||
## How models are chosen
|
||||
|
||||
|
|
@ -193,9 +197,9 @@ python3 tests/test_opencode.py # or run one directly
|
|||
| | |
|
||||
|---|---|
|
||||
| `tests/test_opencode.py` | provider naming and ownership, removal, the credential cache |
|
||||
| `tests/test_proxy.py` | model names, effort mapping, upstream key, streamed-run counting, against a fake server |
|
||||
| `tests/test_proxy.py` | model names, dropping client reasoning settings, upstream key, streamed-run counting, against a fake server |
|
||||
| `tests/test_dashboard.py` | KV parsing, per-run summaries, log collapsing |
|
||||
| `tests/test_reasoning.py` | effort options matching the real chat templates |
|
||||
| `tests/test_reasoning.py` | effort options matching the real chat templates; the setting surviving an update |
|
||||
|
||||
## Continuing on an NVIDIA box
|
||||
|
||||
|
|
@ -249,5 +253,8 @@ On macOS the services are launchd agents, so they run while you're logged in.
|
|||
|
||||
- One model loaded at a time. Asking the API for a different one returns
|
||||
`404 model_not_found` naming the loaded model, rather than answering with it.
|
||||
- Reasoning effort is set on the dashboard, not by the client. A request's own
|
||||
`reasoning_effort` (top-level or in `chat_template_kwargs`) is dropped and the dashboard's
|
||||
setting applied instead.
|
||||
- AMD (ROCm), Intel and CPU-only machines aren't supported yet.
|
||||
- The API and dashboard use plain HTTP and are meant for a trusted LAN. Don't expose them to the internet.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue