Skip to content

[BUG] structured_outputs: strictify_schema_json incorrectly forces all fields to be required #800

Open

Description

@gitlost-murali

strictify_schema_json in the structured_outputs resource server overrides the schema's required list to include every property:

schema["required"] = list(schema["properties"])

This means a model that correctly omits an optional field gets reward 0.0, even though the response is valid per the schema spec.

The training data has schemas with genuinely optional fields. For instance, entry 2 in example.jsonl (patient allergy assessment) has a medicationUse object with no required list at all — the document itself says "Medication Name: Not applicable (field left blank per data schema)." Similarly, the symptoms object only requires severity out of five properties.

Since the prompt shown to the model includes the original schema (with the real required list), this creates a contradictory training signal: the prompt tells the model certain fields are optional, but the reward function demands them all.

The fix is straightforward — just remove the required override and keep only additionalProperties: false.

PR: #799

Activity

  1. changed the title [-]structured_outputs: strictify_schema_json incorrectly forces all fields to be required[/-] [+][BUG] structured_outputs: strictify_schema_json incorrectly forces all fields to be required[/+] on Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions