Skip to content

common/autoparser : use nlohmann::ordered_json to preserve parameter order#20385

Merged
pwilkin merged 1 commit into
ggml-org:masterfrom
aldehir:autoparser-use-ordered-json
Mar 11, 2026
Merged

common/autoparser : use nlohmann::ordered_json to preserve parameter order#20385
pwilkin merged 1 commit into
ggml-org:masterfrom
aldehir:autoparser-use-ordered-json

Conversation

@aldehir

@aldehir aldehir commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

The autoparser used nlohmann::json, which does not preserve order of parameters in tools. This confuses the model, as it attempts to emit parameters in the same order as the JSON schema but is grammar constrained from doing so.

Wondering if this was the underlying issue in #20171.

Renamed json to ordered_json alias since it was conflicting with the json() method.

fixes #20359

@aldehir aldehir changed the title common/autoparser : use nlohmann::ordered_json to preserve parameter … common/autoparser : use nlohmann::ordered_json to preserve parameter order Mar 11, 2026
@aldehir aldehir requested a review from pwilkin March 11, 2026 08:51

@pwilkin pwilkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that was a dumb mistake 😐

@pwilkin pwilkin merged commit b5fe455 into ggml-org:master Mar 11, 2026
13 of 75 checks passed
rsenthilkumar6 pushed a commit to rsenthilkumar6/llama.cpp that referenced this pull request May 1, 2026
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamed and non-streamed tool call arguments contain invalid JSON (mixed single/double quotes) with large payloads

3 participants