fix(routing): offered tools must not make a local model unroutable
Docker / publish (push) Canceled after 0s
Release / crates-io (push) Canceled after 0s
Release / release (macos-14, aarch64-apple-darwin) (push) Canceled after 0s
Release / release (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Canceled after 0s
Release / release (windows-latest, x86_64-pc-windows-msvc) (push) Canceled after 0s
Docker / publish (push) Canceled after 0s
Release / crates-io (push) Canceled after 0s
Release / release (macos-14, aarch64-apple-darwin) (push) Canceled after 0s
Release / release (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Canceled after 0s
Release / release (windows-latest, x86_64-pc-windows-msvc) (push) Canceled after 0s
Verified against a real Open WebUI container: it attaches its ~26 built-in tools (knowledge bases, notes, calendar, ...) to every single message, and resolve() treated that offer as a hard capability requirement. On a pool of tools-less local models a plain "hello" therefore failed with "No healthy model available that satisfies required capabilities", and a pinned local model was reported as "not available - not in the pool (deleted?)". In the OpenAI contract `tools` is an offer; only tool_choice: "required" (or a named function) makes the call impossible without them. Keep preferring a tool-capable model, but fall back to serving the request with the tools stripped - together with tool_choice/parallel_tool_calls, which a provider rejects on their own. A pin whose only shortcoming is tool support is now honoured; an unknown pin and tool_choice: "required" still fail loudly. The downgrade is never silent: X-Cortiq-Tools-Dropped: true, plus cortiq.tools_dropped in the echo block.
This commit is contained in:
@@ -65,6 +65,13 @@
|
||||
HTTP 400 — но не «голый» 422, который OpenAI-клиенты не умеют разбирать (для пользователя
|
||||
это выглядит как отсутствие ответа).
|
||||
|
||||
`tools` трактуется как **предложение**, а не требование. Шлюз предпочитает модель с
|
||||
поддержкой tools, но если такой нет — отвечает без них, а не падает, и сообщает об этом
|
||||
заголовком `X-Cortiq-Tools-Dropped: true` (чат-интерфейсы добавляют свои встроенные tools в
|
||||
каждое сообщение, поэтому строгое прочтение делало обычный чат на локальном пуле без tools
|
||||
невозможным). `tool_choice: "required"` — или именованная функция — это уже настоящее
|
||||
требование, и оно по-прежнему завершается `502 no_healthy_model`, если его некому выполнить.
|
||||
|
||||
### Ответ (без стриминга)
|
||||
|
||||
```jsonc
|
||||
|
||||
Reference in New Issue
Block a user