Skip to content

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

Merged
pwilkin merged 1 commit intoggml-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 intoggml-org:masterfrom
aldehir:autoparser-use-ordered-json

Conversation

@aldehir
Copy link
Collaborator

@aldehir aldehir commented Mar 11, 2026

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
Copy link
Contributor

@pwilkin pwilkin left a comment

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
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