feat: add Gemma 4 tool call parser#269
Merged
Thump604 merged 8 commits intowaybarrios:mainfrom Apr 10, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Unclosed tool call block (server fallback path) - String containing colon (step-ordering guard) - String with real newline and double quote (JSON escaping) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e Code Integration tests that verify the full pipeline (parser → server models → JSON serialization) matches what Claude Code expects: tool_calls structure, null content, function.arguments as JSON string, correct finish_reason. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
integrates Gemma 4 format as the first format tried in auto-detection, adds streaming markers for tool call start/end. based on keegoid's approach in waybarrios#254.
2d0c15d to
95865be
Compare
Owner
|
@jackneil I rebased this on main (clean, no conflicts) and added one commit on top: Gemma 4 auto-detection in AutoToolParser, based on keegoid's approach from #254. This way Gemma 4 tool calls work out of the box with --enable-auto-tool-choice without needing --tool-call-parser gemma4. What I added:
All 121 tool parser tests pass, black and ruff clean. |
waybarrios
approved these changes
Apr 10, 2026
Owner
waybarrios
left a comment
There was a problem hiding this comment.
Rebased, added auto-detection from #254, 121 tests pass. Ready to merge.
This was referenced Apr 10, 2026
Owner
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
gemma4_tool_parser.py— parses Gemma 4's<|tool_call>call:name{<|"|>key<|"|>:val}<tool_call|>format into OpenAI-compatibletool_calls--tool-call-parser gemma4<|tool_call>/<tool_call|>Usage
Test plan
🤖 Generated with Claude Code