-
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
Improve BAML Parser #785
Improve BAML Parser #785
Conversation
* Support parsing fractions as numbers (LLMs tend to like this for fractions, especially repeating values). 1/3 -> 0.33 * Better parsing of objects of single keys: If the schema is { foo: { bar: string }} These all will parse into that: { bar: "..." } { foo: { bar: "..." }} "..." will not auto parse into { foo: { bar: "..." }} * support "," with trailing spaces in parser. Infer as end of key. Sometimes LLMs will use ", " token instead of "," token.
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.
PR Summary
- Added support for parsing fractions as numbers (
engine/baml-lib/jsonish/src/deserializer/coercer/coerce_primitive.rs
) - Improved handling of objects with single keys (
engine/baml-lib/jsonish/src/deserializer/coercer/ir_ref/coerce_class.rs
) - Introduced
InferedObject
flag and related methods (engine/baml-lib/jsonish/src/deserializer/deserialize_flags.rs
) - Enhanced handling of trailing spaces after commas (
engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_parse_state.rs
) - Added new test cases for fractions, single keys, and trailing commas (
engine/baml-lib/jsonish/src/tests/test_basics.rs
,engine/baml-lib/jsonish/src/tests/test_class.rs
)
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
if v.conditions() | ||
.flags() | ||
.iter() | ||
.any(|f| matches!(f, Flag::InferedObject(jsonish::Value::String(_)))) |
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.
Spelling: Typo in Flag::InferedObject
. Should be Flag::InferredObject
.
.any(|f| matches!(f, Flag::InferedObject(jsonish::Value::String(_)))) | |
.any(|f| matches!(f, Flag::InferredObject(jsonish::Value::String(_)))) |
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.
PR Summary
(updates since last review)
- Updated
docs/README.md
to use Fern instead of Mintlify - Added
docs/assets/styles.css
for CSS styling updates - Introduced
docs/docs.yml
for improved documentation structure - Modified multiple
.mdx
files to add slugs, update code block identifiers, and improve formatting - Removed
docs/mint.json
anddocs/v3/analytics/overview.mdx
files
67 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
If the schema is { foo: { bar: string }}
These all will parse into that:
"..." will not auto parse into
{ foo: { bar: "..." }}
If the schema is { foo: { bar: int }}
These all will parse into that:
"... 123 ..." will not parse into
{ foo: { bar: int }}