Skip to content

Conversation

aaronvg
Copy link
Contributor

@aaronvg aaronvg commented Sep 17, 2025

Pull Request Template

Thanks for taking the time to fill out this pull request!

Issue Reference

Please link to any related issues

  • This PR fixes/closes #[issue number]

Changes

This PR enables Jinja templating for @alias and @description attributes in BAML, allowing users to inject dynamic content (e.g., environment variables or simple expressions) into these attributes.

  • Updated engine/baml-lib/baml-core/src/ir/walker.rs to resolve @alias and @description attribute strings using Jinja.
    • Introduced resolve_attribute_string to handle StringOr::Value as Jinja templates, StringOr::JinjaExpression for direct evaluation, and StringOr::EnvVar.
  • Added vars_map() to engine/baml-lib/baml-types/src/value_expr.rs to expose environment variables to the Jinja rendering context.

Testing

Please describe how you tested these changes

  • Unit tests added/updated
    • Added test_attribute_alias_jinja_expression_and_description_template in engine/baml-runtime/src/internal/prompt_renderer/render_output_format.rs.
  • Manual testing performed
    • Tested locally using cargo test -p baml-runtime --lib.
  • Tested in [environment]

Screenshots

If applicable, add screenshots to help explain your changes

[Add screenshots here...]

PR Checklist

Please ensure you've completed these items

  • I have read and followed the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Additional Notes

To avoid building unrelated workspace members (and their Ruby dependencies), tests were run selectively using cargo test -p baml-runtime --lib.

[Add any additional notes here...]


Slack Thread

Open in Cursor Open in Web

This change allows attributes like alias and description to be rendered using Jinja expressions and environment variables.

Co-authored-by: aaron <aaron@boundaryml.com>
Copy link

cursor bot commented Sep 17, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@aaronvg aaronvg temporarily deployed to boundary-tools-dev September 17, 2025 22:41 — with GitHub Actions Inactive
@aaronvg aaronvg temporarily deployed to boundary-tools-dev September 17, 2025 22:41 — with GitHub Actions Inactive
@aaronvg aaronvg temporarily deployed to boundary-tools-dev September 17, 2025 22:41 — with GitHub Actions Inactive
Copy link

vercel bot commented Sep 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
promptfiddle Skipped Skipped Sep 17, 2025 10:41pm

Copy link

Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 95.77465% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
engine/baml-lib/baml-core/src/ir/walker.rs 90.32% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

@aaronvg aaronvg closed this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants