Repository navigation
feat(inkling): message-frame protocol — reasoning, text and JSON tool calls (#650 P3) - #686
Merged
Merged
Conversation
… calls (#650 P3) - Fork pin 580bcbd -> 70d0190 (goodmai/mlx-swift-lm basalt-650-inkling-protocol): ToolCallFormat.inkling and InklingStreamAdapter, ported from ml-explore/mlx-swift-lm#821. Frames are parsed by token id, so marker-shaped text in a payload is text. - Inkling2Model.toolCallFormat is .inkling. - InklingReasoningStateMachine taps <|content_thinking|> frames, because the fork's public Generation stream drops reasoning for framed protocols. The Onyx reasoning tap iterator is now generic over a ReasoningTokenParser, so both protocols share the box and the relay path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh
This was referenced Nov 22, 2026
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.
Part of #650 (Inkling 2), P3 first half: the response protocol.
What
580bcbd→70d0190(goodmai/mlx-swift-lmbranchbasalt-650-inkling-protocol, one commit on top of perf(qwen3next): fused 512-expert router in the fork and in streamed prediction (#642 P1) #681's pin):ToolCallFormat.inklingandInklingStreamAdapter/InklingToolCallParser, ported from Add Inkling 2 Mini and Small ml-explore/mlx-swift-lm#821 (MIT, Apple's header kept) and adapted to this fork'sNaiveStreamingDetokenizer;<|message_model|>name<|content_kind|>payload<|end_message|>are parsed by token id: thinking → reasoning events, text → response,<|content_invoke_tool_json|>→ schema-checked tool calls (undeclared tool, bad JSON, name mismatch → rejected calls); stop at<|content_model_end_sampling|>;<|content_invoke_tool_json|>ortool_parser_typeinkling/inkling2, and is kept as a whole-protocol format like Harmony and Onyx.Inkling2Model.toolCallFormat = .inkling;InklingReasoningStateMachinetaps<|content_thinking|>frames. The fork's publicGenerationstream drops reasoning for framed protocols by design, so basalt taps it the way it already does for Onyx.OnyxReasoningTapIteratoris now generic over a smallReasoningTokenParserprotocol, so both share the box and the relay path.Measured on the real model
mlx-community/Inkling-2-Mini-oQ3e-mtp, release build,basalt serve, temperature 0, CI idle, GPU lock:/v1/chat/completionsturn 1, toolget_weather(city, days:int)finish_reason: tool_calls,get_weather({"days":3,"city":"Paris"})(integer kept),contentempty, reasoning inreasoning_contentcontent/v1/messages(Anthropic)thinkingblock, thentool_useget_weather {"city":"Tokyo"},stop_reason: tool_useTests
InklingProtocolTests(new):<|end_message|>written as text as text;Inkling2Modelselects.inkling, and the real template infers it;handOffWithOnyx→GenerationRelay, a scripted turn (thinking, text, tool frame, end sampling) yields the reasoning, the text, and one tool callweather.get {"days":3}.Inkling, Muse Glimmer (Onyx tap), and tool-call suites: 65 tests pass.
Not in this PR (rest of P3)
Verified
swift build -Xswiftc -warnings-as-errorsclean; no new comments; no size limit exceeded.🤖 Generated with Claude Code
https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh