Repository navigation
fix: honor request reasoning effort and typed Qwen tool parameters - #28
Closed
chris247474 wants to merge 1 commit into
Closed
chris247474 wants to merge 1 commit into
chris247474 wants to merge 1 commit into
Conversation
Owner
|
Thanks @chris247474 for the reasoning-effort and typed-parameter fixes. They're in 0.3.5, which ships tonight, as a commit authored by you. This PR closes when the release is published. |
Contributor
Author
Thanks for including this little contribution @ashhart and for all the work on this! Roughly doubled the decode speed on my M5 Pro 48GB RAM machine. |
Owner
|
Thanks @chris247474! This landed in 0.3.5 as 8c8dcec, authored by you, and ships in https://github.com/ashhart/TensorFold/releases/tag/v0.3.5. |
ashhart
pushed a commit
that referenced
this pull request
Sep 29, 2026
The Mac server has decoded Qwen `<parameter=k>` values by the tool's JSON schema since 0.3.5 (#28); the CUDA server's parser still returned every value as a string, so an array parameter reached the client as "[\"a\", \"b\"]" instead of ["a", "b"] and strict clients rejected the call. cuda/reply_text.parse_tool_calls now runs each value through the same tool_parameters.decode_parameter the Mac server uses: array, object, boolean, integer, number and null parameters decode when the text is valid JSON of that type, anything else keeps its exact text.
This was referenced Oct 19, 2026
kelchm
pushed a commit
to kelchm/TensorFold
that referenced
this pull request
Nov 7, 2026
The grammar was built inside Stream.init's argument list, and only a started job frees it, so a Stream.init that failed after the build leaked it. It is now built first and freed on that failure. Only out-of-memory reaches this path. Adapted to this engine by Mia's AI Lab from the second half of SvangenStudios' 0039 on https://github.com/MiaAI-Lab/DeepSeek-V4.1-Flash-1017-4x-DGX-Sparks-TensorFold (PR ashhart#28); the use-after-free that PR's first half fixes is not present here. Origin: MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104@13f2464 patches/engine 0093-lanes-a-reply-grammar-is-freed-when-its-stream-cannot-start.patch sha256:636b0a5eef48c67654448f2c346f8dbe57d824789126d6175393111642896a95
Maxrio9
added a commit
to Maxrio9/TensorFold
that referenced
this pull request
Nov 25, 2026
…ning_effort compatibility Ports MiaAI-Lab's Inkling-2-Mini-DGX-Spark-TensorFold patches 0013 (structured output and tool_choice on CUDA, xgrammar 0.2.8 cache bypass), 0017 (reply grammar freed on stream-start failure, opt-in tool-call guard; from SvangenStudios PR ashhart#28) and 0010 (vLLM-compatible reasoning_effort and reasoning field) to the EXL3 Mini engine with DSpark and shared forward. RTX PRO 4500, 3.3bpw: required, named and json_schema replies 10/10 valid each at 1 and 2 parallel requests with and without drafts; plain decode unchanged. Co-authored-by: MiaAI Lab <[email protected]> Co-authored-by: ajensenwaud <[email protected]>
kelchm
added a commit
to kelchm/TensorFold
that referenced
this pull request
Nov 26, 2026
lane_stream.open constructed the reply grammar inline inside lanes.Stream.init's argument struct, and LaneHost.finish only frees Stream.grammar when job.started is true. If lanes.Stream.init failed with error.OutOfMemory after h.constraint succeeded, both the Constraint allocation and its underlying grammar matcher leaked. Build the reply grammar before calling lanes.Stream.init and call deinit(h.gpa) in the Stream.init catch path, matching freeProposer and recalls.release. Add a deterministic failing-allocator host regression test in lane_host_grammar_test.zig proving both the matcher and Constraint leak before the fix and clean deallocation after it. Originally authored by SvangenStudios in MiaAI-Lab/DeepSeek-V4.1-Flash-1017-4x-DGX-Sparks-TensorFold (PR ashhart#28, Apache-2.0) and adapted via MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104 (Apache-2.0) patch 0007. Co-authored-by: SvangenStudios <[email protected]> Co-authored-by: MiaAI-Lab <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Qwen XML tool calls currently serialize every parameter as a string. An array-valued parameter such as OpenCode's
questionstherefore fails client schema validation with “Expected array, got string”. Decode explicitly typed parameters using the offered tool schema in both the final parser and incremental streamer, while preserving string values and whitespace. Typed streamed values are buffered until their closing tag; malformed or mismatched values remain strings for client validation.Chat requests also currently ignore
reasoning_effort. Honor per-requestnone,low,medium,high, andxhighwithout mutating server defaults; maphighto Qwen'sxhigh, and preserve explicitchat_template_kwargs.enable_thinkingprecedence. Apply the request effort consistently to prompt, history, and system-prefix rendering, and report the effective setting in runtime metadata.Includes regression tests and README documentation. Changes target the MLX server; union/reference schema resolution and a separate reasoning-token budget are outside this change.
Validation
git diff --checkpassed.pip wheel --no-deps.Based on upstream main
bb4b4a35863af562fc4ccb2586300d8f94b5d6de.