-
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: Support parsing primitive values from single-key objects #1224
fix: Support parsing primitive values from single-key objects #1224
Conversation
- Add support for object-wrapped numbers and booleans\n- Only extract values from simple single-key objects with primitive values\n- Reject nested objects and arrays\n- Add ImpliedKey flag to track extracted field names\n- Add comprehensive test cases
@revidious is attempting to deploy a commit to the Gloo Team on Vercel. A member of the Team first needs to authorize it. |
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 b4bf23f in 1 minute and 42 seconds
More details
- Looked at
178
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/coerce_literal.rs:7
- Draft comment:
Theuse std::vec;
statement is unnecessary as thevec!
macro is already included in the prelude. - Reason this comment was not posted:
Confidence changes required:50%
The comment should be placed on the first line of the diff, which is line 7.
2. engine/baml-lib/jsonish/src/deserializer/coercer/coerce_literal.rs:47
- Draft comment:
Consider adding a log statement here to indicate that a single-key object is being processed. This can help in debugging and understanding the flow of data. - Reason this comment was not posted:
Confidence changes required:33%
The comment should be placed on the first line of the diff, which is line 7.
Workflow ID: wflow_dqxyZ8MpTJD0MMpq
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
LGTM!
Description
Fixes #1141
This PR adds support for parsing primitive values from single-key objects in unions. When an LLM responds with an object-wrapped primitive (e.g.,
{"status": 1}
), we now correctly extract and validate the inner value.Changes
ImpliedKey
flag{"status": {"code": 1}}
){"values": [1]}
)Test Plan
Added test cases covering:
{"status": 1}
→1
All tests are passing.
Important
Adds support for parsing primitive values from single-key objects in unions, with tests for valid and invalid cases.
coerce_literal.rs
.ImpliedKey
flag to track extracted key names.test_literals.rs
for basic object extraction, multiple primitive types, and invalid cases (nested objects, arrays).This description was created by for b4bf23f. It will automatically update as commits are pushed.