Skip to content

common: preserve horizontal whitespace in tool calls - #23602

Open
Krish2882005 wants to merge 1 commit into
ggml-org:masterfrom
Krish2882005:fix-tool-call-whitespace
Open

Krish2882005 wants to merge 1 commit into
ggml-org:masterfrom
Krish2882005:fix-tool-call-whitespace

Conversation

@Krish2882005

@Krish2882005 Krish2882005 commented May 24, 2026 •

Copy link
Copy Markdown

Overview

The parser was using trim_leading_space and trim_trailing_space to clean up tool call arguments. If a parameter is on the same line as the tag, this stripped the horizontal indentation.

Swapped the inline trim calls for a new helper trim_bounding_newlines that only checks for and removes \n or \r\n.

Additional information

Fixes #23535
Added a test to test-chat-peg-parser.cpp.

Requirements

@Krish2882005
Krish2882005 requested review from a team and ggerganov as code owners May 24, 2026 09:02
@github-actions github-actions Bot added the testing Everything test related label May 24, 2026
@Wren6991

Copy link
Copy Markdown

I've built this PR and confirmed it fixes my original issue, #23535

@aldehir

aldehir commented May 28, 2026

Copy link
Copy Markdown
Contributor

This PR is touching code that impacts multiple models to address an issue for Qwen. I understand it's a problem worth fixing, but it needs to be addressed differently.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: whitespace is stripped from tool call parameters, producing incorrect results

3 participants