Skip to content

fix(validation): require is_valid in Validator#2230

Merged
jxnl merged 1 commit into567-labs:mainfrom
aress31:fix/llm-validator-strict-schema
Mar 28, 2026
Merged

fix(validation): require is_valid in Validator#2230
jxnl merged 1 commit into567-labs:mainfrom
aress31:fix/llm-validator-strict-schema

Conversation

@aress31
Copy link
Copy Markdown
Contributor

@aress31 aress31 commented Mar 28, 2026

Fixes #2225

Summary

This PR makes Validator.is_valid required instead of relying on a default value.

What Changed

  • Removed the default True value from Validator.is_valid
  • Made reason required as well

Why

The issue describes a fail-open case where partial validator output like:

{"reason": "value violates the rule"}

can be interpreted as valid because is_valid falls back to a default.

Rather than changing the fallback behavior, this PR enforces the expected schema so responses that omit is_valid fail validation instead of being treated as valid.

Issue: #2225

@jxnl jxnl merged commit 7cf8015 into 567-labs:main Mar 28, 2026
@aress31 aress31 deleted the fix/llm-validator-strict-schema branch March 28, 2026 18:01
conjon42 pushed a commit to conjon42/instructor that referenced this pull request May 7, 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.

llm_validator can fail open when validator response omits is_valid

2 participants