-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix parsing for streaming of objects more stable #1031
Conversation
…hrowing away data by picking default values
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 916851c in 13 seconds
More details
- Looked at
172
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs:85
- Draft comment:
The new condition forBamlValueWithFlags::Class
in the sorting logic is a significant change. Ensure that this logic correctly identifies and handles default values as intended. Double-check the conditions and flags used here to avoid any logical errors. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces a new condition in the sorting logic ofpick_best
function to handleBamlValueWithFlags::Class
types. This is a significant change and should be carefully reviewed for correctness.
2. engine/baml-lib/jsonish/src/tests/test_partials.rs:262
- Draft comment:
The JSON string is incorrectly wrapped with backticks. Ensure that the JSON string is correctly formatted to avoid parsing issues. - Reason this comment was not posted:
Confidence changes required:50%
The test casetest_partial_choppy
intest_partials.rs
is using backticks incorrectly for JSON strings. This might cause issues in parsing or understanding the test data.
Workflow ID: wflow_auoK0viJlD1CnoHr
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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! Incremental review on 5cd5e65 in 12 seconds
More details
- Looked at
190
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs:94
- Draft comment:
Consider refactoring the logic for checkingFieldType::Union(_)
and handling default values and coerced strings for better readability and performance. The current nested structure can be simplified. - Reason this comment was not posted:
Confidence changes required:50%
The use ofmatches!
for checkingFieldType::Union(_)
is correct, but the logic for handling default values and coerced strings could be optimized for readability and performance.
2. engine/baml-lib/jsonish/src/tests/test_partials.rs:336
- Draft comment:
Ensure that the expected output intest_partial_choppy_union_2
matches the intended behavior of the code changes, especially with the handling of union types and default values. - Reason this comment was not posted:
Confidence changes required:33%
The test casetest_partial_choppy_union_2
is correctly set up to test the union type handling, but ensure that the expected output matches the intended behavior of the code changes.
Workflow ID: wflow_uMOmdDzUYshT8KLk
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
We penalize objects that are throwing away data by picking default values.
For example, during parsing of complex objects, we sometimes prefer an empty object of default values, but instead we can prefer something else. This also works for handling bad union disambiguation.
Important
Improve object streaming stability by refining default value handling in deserialization and enhancing logging and tests.
pick_best()
inarray_helper.rs
to penalize default values like null or empty lists when selecting best values.BamlValueWithFlags::Class
to check for default flags in properties.println!
withlog::info!
inmacros.rs
for better logging control.log::trace!
for score logging inmacros.rs
.test_partial_choppy
intest_partials.rs
to test partial deserialization with incomplete data.test_partial_deserializer!
macro inmacros.rs
to include score logging.This description was created by for 916851c. It will automatically update as commits are pushed.