Skip to content

parser: fix structured output bug#22302

Open
pwilkin wants to merge 2 commits intoggml-org:masterfrom
pwilkin:stupid-schema-bug
Open

parser: fix structured output bug#22302
pwilkin wants to merge 2 commits intoggml-org:masterfrom
pwilkin:stupid-schema-bug

Conversation

@pwilkin
Copy link
Copy Markdown
Member

@pwilkin pwilkin commented Apr 23, 2026

Overview

Fix stupid bug.

Additional information

No, I mean really stupid. Look at the code if you don't believe me.

Requirements

Fixes #21571

@pwilkin pwilkin requested a review from a team as a code owner April 23, 2026 22:50
@pwilkin pwilkin requested review from CISC and aldehir and removed request for a team April 23, 2026 22:51
@pwilkin pwilkin added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Apr 23, 2026
@pwilkin
Copy link
Copy Markdown
Member Author

pwilkin commented Apr 23, 2026

@ggml-org/maintainers need second approval plz

@github-actions github-actions Bot added script Script related examples python python script changes server labels Apr 23, 2026
@aldehir
Copy link
Copy Markdown
Contributor

aldehir commented Apr 24, 2026

Sure, if you pass in both json_schema and response_format with {"type": "json_object"}. But aren't you supposed to do this:

response_format={
  "type": "json_schema",
  "json_schema": { ... }
}

Instead of adding it under extra_body?

@ggerganov ggerganov removed the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Apr 24, 2026
@ggerganov
Copy link
Copy Markdown
Member

ggerganov commented Apr 24, 2026

The tests are not passing

@pwilkin
Copy link
Copy Markdown
Member Author

pwilkin commented Apr 24, 2026

Yeah, turns out it isn't so simple: I have to handle the case where someone separately set the schema in extra body, but response format in the direct payload AND the case where someone just did json_object without a schema, which should nevertheless result in a generic JSON output format constraint.

Should be good now.

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

Labels

examples python python script changes script Script related server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: Structured Output - JSON Schema - Failed to initialize samplers

3 participants