Skip to content

Conversation

@hellovai
Copy link
Contributor

@hellovai hellovai commented Dec 6, 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 addresses a frequently requested feature to allow string inputs for tests to be loaded from external files.

Changes

Please describe the changes proposed in this pull request

This PR introduces the ability to load string parameter values for BAML tests directly from external text files.

Key changes include:

  • New Syntax: args { param { file "path/to/file.txt" } } is now supported for string type parameters.
  • Relative Path Resolution: File paths are resolved relative to the BAML file containing the test.
  • Union Precedence: Implemented left-to-right union precedence to correctly distinguish file references from struct properties named file, aligning with existing media type handling.
  • Error Handling: Improved error messages for missing files or invalid properties.
  • Documentation: Updated test.mdx to reflect the new functionality.

This feature is particularly useful for managing long text inputs, improving test organization, and reusing test data.

Testing

Please describe how you tested these changes

  • Unit tests added/updated:
    • test_file_as_string: Basic file reading with an absolute path.
    • test_file_as_string_relative_path: Correct resolution of relative file paths.
    • test_file_as_string_missing_file: Proper error handling for non-existent files.
  • Manual testing performed: Verified the new syntax with an integration test.
  • Tested in local development 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

Add any other context about the PR here

This change addresses the need for a more flexible way to provide string inputs to BAML tests, especially for large or frequently updated content. The approach leverages existing patterns for handling media files to ensure consistency and avoid ambiguity with struct definitions.


Slack Thread

Open in Cursor Open in Web

This change allows string arguments to be populated from external files using the `{ file "path" }` syntax. This improves test organization and handling of large string inputs.

Co-authored-by: vbv <[email protected]>
@cursor
Copy link

cursor bot commented Dec 6, 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

@vercel
Copy link

vercel bot commented Dec 6, 2025

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

Project Deployment Preview Comments Updated (UTC)
promptfiddle Error Error Dec 6, 2025 7:40pm

@hellovai hellovai temporarily deployed to boundary-tools-dev December 6, 2025 19:23 — with GitHub Actions Inactive
@hellovai hellovai temporarily deployed to boundary-tools-dev December 6, 2025 19:23 — with GitHub Actions Inactive
@hellovai hellovai temporarily deployed to boundary-tools-dev December 6, 2025 19:23 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

@hellovai
Copy link
Contributor Author

we now support template_strings in tests so closing out.

@hellovai hellovai closed this Dec 24, 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.

3 participants