fix(openai): reask functionality broken in JSON mode since v1.9.0#1793
Merged
jxnl merged 3 commits into567-labs:mainfrom Sep 5, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to b6a47d9 in 39 seconds. Click for details.
- Reviewed
18lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. instructor/processing/function_calls.py:97
- Draft comment:
By removing the wrapping in a custom InstructorValidationError and simply re-raising the original exception, the original error types (e.g. JSONDecodeError or ValidationError) are correctly propagated. This addresses the reask issue in JSON mode. Ensure tests verify that downstream retry logic now catches these specific exceptions as intended. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =80%<= threshold85%The comment is informative and suggests ensuring that tests verify the new behavior. It doesn't directly ask the author to confirm their intention or update the PR description. However, it does suggest a specific action related to testing, which is acceptable. The comment is useful as it highlights a change in exception handling and its implications on downstream logic.
Workflow ID: wflow_AP6rXmB7MJQgK42n
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since v1.9.0, from this PR: #1549, the reask functionality with JSON mode is broken.
Irrespective of whether the underlying error is a
JSONDecodeErrororValidationError, both are being wrapped underinstructor.core.exceptions.ValidationErrorHence in
retry_sync/retry_asyncofinstructor/core/retry.py, these wrapped errors are always caught by the genericExceptionblock instead of the specific(ValidationError, JSONDecodeError)block, even when those specific exception types should trigger retries with error messages includedImportant
Fixes reask functionality in JSON mode by removing exception wrapping in
_validate_model_from_json()to allow specific exception handling._validate_model_from_json()infunction_calls.py.JSONDecodeErrorandValidationErrorto be caught specifically inretry_sync/retry_asyncinretry.py.instructor.core.exceptions.ValidationErrorin_validate_model_from_json()._validate_model_from_json().This description was created by
for b6a47d9. You can customize this summary. It will automatically update as commits are pushed.