https://www.boundaryml.com logo
🟡 Dynamic Expected Values in BAML Assertions
# questions
r
Just started on BAML. I'm halfway studying evals in BAML. Does BAML have a feature to assert against a dynamic expected value? For a given input I have different expected values, but all the assert examples I've seen so far are in the data model; asserting generic characteristics such as greater than x less than y etc. I want to be able to compare to an expected value passed into the function. Or is this level of eval intended to be done somewhere else, eg Python.
v
as of now this is not yet possible! but we are actively working on enabling this. (we have some interal syntax and runtime behaviour that works), but currently not in the shipped version. for now we recommend pytest for complicated asserts
for that you would write something like:
Copy code
python
def test_foo():
  result = b.MyFunction(params)
  compare(result, expected_result)
and compare can be w/e function you want
r
Thanks for the clarification. Keen to see the feature shipped.
2 Views