-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support individual partial enum values #1228
Open
mwildehahn
wants to merge
9
commits into
instructor-ai:main
Choose a base branch
from
mwildehahn:mh-partial-enums
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 15d0093 in 47 seconds
More details
- Looked at
135
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. instructor/dsl/partial.py:13
- Draft comment:
Any
is imported twice. Remove the duplicate import on line 18. - Reason this comment was not posted:
Confidence changes required:50%
The import statement forAny
is duplicated, which is unnecessary and can be removed for cleaner code.
2. instructor/dsl/partial.py:55
- Draft comment:
ReturningNone
for invalid literals might lead to unexpected behavior. Consider raising a validation error or handling this case explicitly. - Reason this comment was not posted:
Confidence changes required:50%
ThePartialLiteralValidator
class is designed to validate literal values, but it returnsNone
if the value is not in the literal type. This could lead to unexpected behavior if not handled properly. It might be better to raise a validation error or handle this case explicitly.
3. instructor/dsl/partial.py:104
- Draft comment:
Consider adding a comment to explain the logic for handlingPartial
in field metadata when dealing withLiteral
types. - Reason this comment was not posted:
Confidence changes required:33%
ThePartialLiteralValidator
is used to validate literal types, but the logic for handlingPartial
in field metadata is not clearly explained. A comment explaining this logic would improve code readability.
4. tests/dsl/test_partial.py:230
- Draft comment:
Typo in comment: 'partil' should be 'partial'. - Reason this comment was not posted:
Confidence changes required:10%
The test casetest_partial_enums
has a typo in the comment on line 230. It should be 'partial' instead of 'partil'.
5. tests/dsl/test_partial.py:57
- Draft comment:
Assertions should include error messages for clarity and debugging purposes. This applies to all assertions in this file. - Reason this comment was not posted:
Confidence changes required:80%
The assertion statements in the test file lack error messages, which are important for debugging when tests fail.
6. instructor/dsl/partial.py:60
- Draft comment:
Function names should follow a consistent naming pattern. Consider using snake_case for all function names to maintain consistency. - Reason this comment was not posted:
Confidence changes required:70%
The function names in the code are inconsistent. Some functions use snake_case while others use camelCase. Consistent naming conventions should be followed.
Workflow ID: wflow_NMW6RGhC1ZPqHg3J
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Support partial enums
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.
If you use literal values with partial it fails as the model is generating partial values.
PartialLiteralMixin
is one approach to fixing this but then means no other string values will stream as they're processed.This is another approach that doesn't change how we parse the JSON, but just means the partial model won't validate these enums until they're fully resolved.
Important
Adds support for handling partial enum values in JSON parsing using
PartialLiteralValidator
and updates tests accordingly.PartialLiteralValidator
inpartial.py
to handle partial enum values._make_field_optional()
to usePartialLiteralValidator
forLiteral
types withPartial
.test_partial_enums()
intest_partial.py
to validate partial enum handling.This description was created by for 15d0093. It will automatically update as commits are pushed.