[WIP] Gemma4 reasoning parser#4191
Open
dkalinowski wants to merge 1 commit intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends OVMS LLM output parsing to support extracting “reasoning” segments from Gemma4 model outputs by reusing and parameterizing the existing Qwen3 reasoning parser.
Changes:
- Refactors
Qwen3ReasoningParserto allow configurable start/end tags and to expose whether streaming requires special tokens. - Adds
Gemma4ReasoningParserand wires it intoOutputParserselection via--reasoning_parser=gemma4. - Updates Bazel build and user documentation to include the new parser option.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/llm/io_processing/qwen3/reasoning_parser.hpp |
Makes Qwen3 reasoning tag handling configurable and adds a special-tokens requirement flag for streaming. |
src/llm/io_processing/output_parser.cpp |
Registers gemma4 as a supported reasoning parser option. |
src/llm/io_processing/gemma4/reasoning_parser.hpp |
Introduces Gemma4 reasoning parser as a thin specialization of Qwen3 reasoning parser. |
src/llm/BUILD |
Adds the Gemma4 reasoning parser header to the output_parsers library. |
docs/parameters.md |
Documents gemma4 as a supported --reasoning_parser value. |
Comment on lines
+141
to
142
| | `--reasoning_parser` | `string` | Type of parser to use for reasoning content extraction from model output. Currently supported: [qwen3, gemma4] | | ||
| | `--tool_parser` | `string` | Type of parser to use for tool calls extraction from model output. Currently supported: [llama3, hermes3, phi4] | |
Comment on lines
179
to
183
| if (reasoningParserName == "qwen3") { | ||
| reasoningParser = std::make_unique<Qwen3ReasoningParser>(tokenizer); | ||
| } else if (reasoningParserName == "gemma4") { | ||
| reasoningParser = std::make_unique<Gemma4ReasoningParser>(tokenizer); | ||
| } else if (reasoningParserName == "gptoss") { |
Collaborator
Author
|
To be done: add mapping document which tool parsers are for which models |
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.
No description provided.