You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tool_choice: "required" is accepted but not enforced #52
Summary.tool_choice: "required" is accepted but not enforced: the model can answer in plain text with finish_reason: "stop". In OpenAI's API, "required" means the reply must contain at least one tool call.
Environment. TensorFold 0.3.5.1 (beddbb7), Vontra/Qwen3.8-27B-MLX-4bit, Apple M1 Max, macOS 27.0.
This returns finish_reason: "stop", content "Hello! How can I help you today?", and no tool_calls.
Where.active_tool_specs / tool_choice_disables_tools in server/tools.py act only on "none"; validate_tool_choice checks the named-function form. Nothing else reads "required". tool-eval-bench's TC-45 (tool_choice=required Compliance) fails for this reason. vLLM and SGLang pass it by constraining decoding to a tool call.
If enforcing it is out of scope for now, returning a 400 for "required" would at least avoid silently ignoring it. docs/api.md currently documents only "none".
Thanks @simonmd. tool_choice: "required" is enforced in 0.3.6.2 on the Mac and CUDA servers. We don't have a grammar
engine like vLLM's, so the server fixes only what it has to. After any think block, the answer must open a tool call,
and the tool's name must be one you offered. If the model starts in prose, that token becomes <tool_call> plus the
template's text before a name. If it reaches for a tool you didn't offer, the name becomes the first offered one it
can still spell. The model writes the arguments. A function named in tool_choice works the same way, and the
template then offers only that tool.
Each fix depends only on the tokens before it, so drafted, serial ("draft": false) and concurrent requests produce
the same tokens, and the same request gives the same tokens on a Mac and on a DGX Spark. Your repro now returns a get_weather call with finish_reason: "tool_calls", with thinking on or off, streamed or not. Holding the name
mattered: with only the opener forced, Flash Next called an update_plan tool that wasn't in the request. One limit:
required parameters aren't enforced, so a model can still send {} to a tool that needs arguments. docs/api.md has
the details. Release: https://github.com/ashhart/TensorFold/releases/tag/v0.3.6.2
Activity
feat(glm5_next): the latent MLA cache holds 256k tokens on two Sparks…
release: TensorFold 0.3.6.2
simonmd commentedon Sep 28, 2026
Verified fixed in 0.3.6.2 (71377a5) on the same setup: Apple M1 Max, macOS 27.0,
Vontra/Qwen3.8-27B-MLX-4bit.finish_reason: "tool_calls"with aget_weathercall, instead of plain text.Thanks for the quick fix. This can be closed.
ashhart commentedon Sep 28, 2026
Thanks @simonmd.
tool_choice: "required"is enforced in 0.3.6.2 on the Mac and CUDA servers. We don't have a grammarengine like vLLM's, so the server fixes only what it has to. After any think block, the answer must open a tool call,
and the tool's name must be one you offered. If the model starts in prose, that token becomes
<tool_call>plus thetemplate's text before a name. If it reaches for a tool you didn't offer, the name becomes the first offered one it
can still spell. The model writes the arguments. A function named in
tool_choiceworks the same way, and thetemplate then offers only that tool.
Each fix depends only on the tokens before it, so drafted, serial (
"draft": false) and concurrent requests producethe same tokens, and the same request gives the same tokens on a Mac and on a DGX Spark. Your repro now returns a
get_weathercall withfinish_reason: "tool_calls", with thinking on or off, streamed or not. Holding the namemattered: with only the opener forced, Flash Next called an
update_plantool that wasn't in the request. One limit:required parameters aren't enforced, so a model can still send
{}to a tool that needs arguments. docs/api.md hasthe details. Release: https://github.com/ashhart/TensorFold/releases/tag/v0.3.6.2
feat(glm5_next): the latent MLA cache holds 256k tokens on two Sparks…
release: TensorFold 0.3.6.2