-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: Add constraints via Jinja expressions #1006
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
bfcb239
to
0e483ac
Compare
0e483ac
to
6e4c75a
Compare
803cec8
to
74fd792
Compare
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.
❌ Changes requested. Incremental review on 4ad7ea4 in 2 minutes and 12 seconds
More details
- Looked at
70
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. engine/baml-lib/baml-types/src/baml_value.rs:464
- Draft comment:
Useiter()
instead ofinto_iter()
to avoid consuming the vector.
v.iter().map(|v| v.map_meta(f)).collect(), f(m)
- Reason this comment was not posted:
Comment was on unchanged code.
2. engine/baml-lib/baml-types/src/baml_value.rs:470
- Draft comment:
Useiter()
instead ofinto_iter()
to avoid consuming the vector.
fs.iter().map(|(k, v)| (k.clone(), v.map_meta(f))).collect(), f(m)
- Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_GmiEyLxH0oXTxeSp
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. 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 362a80f in 1 minute and 51 seconds
More details
- Looked at
34
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_deQM19aeYuQFSYbi
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
362a80f
to
a11d96e
Compare
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.
❌ Changes requested. Incremental review on a11d96e in 1 minute and 55 seconds
More details
- Looked at
29
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. shell.nix:43
- Draft comment:
Ensure thatlld_18
is necessary for the build environment and compatible with other tools. - Reason this comment was not posted:
Confidence changes required:50%
The addition oflld_18
inshell.nix
should be verified for necessity and compatibility with the rest of the environment.
Workflow ID: wflow_BULDaaVB6hGS0TG0
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. 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 a1ade48 in 1 minute and 22 seconds
More details
- Looked at
12
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/baml-runtime/src/tracing/mod.rs:8
- Draft comment:
Remove unused importinternal_baml_core::ir::jinja_helpers::ConstraintExpressionError
. - Reason this comment was not posted:
Confidence changes required:50%
The unused import should be removed to maintain clean code.
Workflow ID: wflow_PLiXmR5YtAHijy5R
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 0f18524 in 1 minute and 17 seconds
More details
- Looked at
319
lines of code in8
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/baml-runtime/src/cli/serve/mod.rs:366
- Draft comment:
Consider refactoring the repeated pattern of handlingresult_with_constraints_content()
into a helper function to reduce code duplication and improve maintainability. This pattern appears in multiple files, such asengine/baml-runtime/src/tracing/mod.rs
,engine/baml-runtime/src/types/response.rs
, and others. - Reason this comment was not posted:
Confidence changes required:50%
The code in multiple files has a repeated pattern of handling the result ofresult_with_constraints_content()
. This pattern can be simplified by using a helper function to avoid code duplication and improve maintainability.
Workflow ID: wflow_d0nh26cIIfIFDyLB
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 ac8b7ed in 1 minute and 11 seconds
More details
- Looked at
12
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/baml-lib/baml-types/src/baml_value.rs:446
- Draft comment:
Consider re-adding theunimplemented!()
macro to handle potential future variants ofBamlValue
. This ensures that any new variants are explicitly handled. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_5rQ3a6xbhrwhlzQz
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
ac8b7ed
to
7508237
Compare
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 7508237 in 2 minutes and 39 seconds
More details
- Looked at
9870
lines of code in129
files - Skipped
1
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. engine/baml-lib/baml-core/src/ir/ir_helpers/mod.rs:185
- Draft comment:
Consider usinganyhow::anyhow!
consistently for error handling instead of mixing withanyhow::bail!
. - Reason this comment was not posted:
Confidence changes required:50%
The use ofanyhow::bail!
andanyhow::anyhow!
for error handling is inconsistent. It's better to use one consistently for clarity and maintainability.
2. engine/baml-lib/baml-core/src/ir/jinja_helpers.rs:87
- Draft comment:
Consider providing a more informative error message for theevaluate_predicate
function. This will help in debugging issues related to constraint evaluation. - Reason this comment was not posted:
Confidence changes required:50%
The error message for theevaluate_predicate
function is not informative. It should provide more context about the error.
Workflow ID: wflow_qOhG8h1Q2Zeu1rZT
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 7f2b597 in 1 minute and 15 seconds
More details
- Looked at
72
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/baml-lib/jsonish/src/tests/mod.rs:123
- Draft comment:
The functiondistribute_constraints
is used here but has been removed. This will cause a compilation error. Consider re-implementing or replacing its functionality. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment correctly identifies that the functiondistribute_constraints
was removed and that the code now usesoutput.distribute_constraints()
. This suggests a method call onoutput
, which is likely an instance of a type that now hasdistribute_constraints
as a method. The comment is valid because it highlights a potential issue if the method is not correctly implemented, leading to a compilation error.
I might be assuming too much about the context of the change without seeing the implementation ofdistribute_constraints
as a method. It's possible that the method is correctly implemented elsewhere, and the comment might be unnecessary.
The comment is still useful because it highlights a potential issue that needs to be verified, even if the method is implemented elsewhere. It ensures that the change is intentional and correctly handled.
Keep the comment as it correctly identifies a potential issue with the removal of the function and the change to a method call, which could lead to a compilation error if not handled properly.
Workflow ID: wflow_Bupm5BgMOgBKUHPo
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 dfaad86 in 1 minute and 10 seconds
More details
- Looked at
14
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/baml-lib/parser-database/src/attributes/to_string_attribute.rs:30
- Draft comment:
The comment indicates that the validation logic forassert
andcheck
attributes is not executed. This could lead to unexpected behavior if these attributes are used. Consider investigating why this validation is not triggered and ensure it is executed as intended. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_JJJCcBOVBE0O4mQU
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 6aac2cd in 1 minute and 18 seconds
More details
- Looked at
47
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_n8JHIwQa5MJahoRW
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 aa31f42 in 1 minute and 30 seconds
More details
- Looked at
67
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/language_client_codegen/src/typescript/mod.rs:12
- Draft comment:
Thecheck_types
field was removed fromAsyncTypescriptClient
,SyncTypescriptClient
, andTypescriptClient
. Ensure that any functionality relying on type checking is not affected by this removal. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_uZSAu47dAOmlbGhp
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 316ac5f in 2 minutes and 12 seconds
More details
- Looked at
37
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. engine/language_client_ruby/ext/ruby_ffi/src/ruby_to_json.rs:30
- Draft comment:
Thetype_name_for_checks
function returns a hardcoded "String". Consider implementing it properly or removing it if not needed. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is about a function that was removed in the diff, so the issue it raises has already been resolved. Therefore, the comment is not necessary.
I might be missing the context of why the function was removed, but since the function is no longer present, the comment is not relevant.
The removal of the function indicates that the issue raised by the comment has been addressed, making the comment obsolete.
The comment should be deleted because the function it refers to has been removed, resolving the issue.
Workflow ID: wflow_PXbzRrNmK6uD0Jys
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Generated with ❤️ by ellipsis.dev |
7229bbf
to
43c8dfc
Compare
Generated with ❤️ by ellipsis.dev |
Important
This PR adds support for constraints using Jinja expressions, updates models and validation logic, and enhances testing for constraint functionality.
baml-core
.evaluate_predicate
ininternal_baml_jinja
for constraint evaluation.FieldType
to supportConstrained
type with constraints.Constraint
andConstraintLevel
inbaml-types
.NodeAttributes
to include constraints.validation_pipeline
.test_constraints.rs
.itertools
dependency inCargo.lock
.shell.nix
to include necessary tools for development.This description was created by for 316ac5f. It will automatically update as commits are pushed.