BAML
QuickstartBlogPodcastTeam
DiscordGitHub8,423Learn BAML
Learn BAMLQuickstartBlogPodcastTeam
DiscordGitHub8,423
Release8 days ago4 min read

BAML 0.18.0

Granular LLM call introspection, async Python streams, execution trace queries, expanded reflection, and a faster compiler and stream parser.

Features

  • Add on_event to enable granular LLM call introspection (#4570) - aaronvg
  • In Python, allow using async for to iterate over LLM streams (#4604) - aaronvg
  • Implement baml query to allow querying historical BAML program execution traces, and allow exploring them using the playground (#4548; #4563; #4578) - rossirpaulo
  • Improve Python SDK compatibility with BAML v0: allow previewing prompts without requiring secrets, add FinishReasonError, expose OpenAI/Anthropic/Vertex-specific response metadata, and more (#4459) - aaronvg
  • Add baml.io.Read and baml.io.Write interfaces and make all stdlib I/O abstractions implement them (#4606) - Avery Townsend
  • Allow using baml.json.to_string and to_json with unknown. (#4601) - Antonio Sarosi
  • Expanded reflection API: add reflect.AnyClass, reflect.call_any, allow unreflect(expr) in any type position (#4491; #4493; #4519; #4574; #4600) - Antonio Sarosi
  • Allow truthiness conversions, e.g. if (0) is now allowed; also improve type narrowing in if blocks (#4498) - Avery Townsend
  • Make more interface member projections work: (Type as Interface).member and Interface.instance_method(instance) (#4500) - 2kai2kai2
  • Improve lambda type inference: allow using invocations of a lambda to infer its arg types, when the lambda is defined without them (#4599) - Avery Townsend
  • Add baml.errors.UnknownError for wrapping errors while preserving original cause and stack trace (#4441) - Avery Townsend
  • Add lazy iterator primitives: take, skip, take_while, and skip_while. (#4510) - Ritunjay
  • Add an optional rng parameter to int.random(), float.random(), bool.random(), and bigint.random() (#4135) - 2kai2kai2
  • Make baml run and baml test respect BAML_LOG and --log <LEVEL> (#4408; #4409) - Sam Lijin

Breaking and compatibility changes

  • Continue stabilizing the ai.Runner interface (#4604) - aaronvg
  • Reflection types and methods are now consolidated into reflect.*: we now have reflect.Type, reflect.AnyClass, reflect.AnyFunction, and everything from baml.reflect.* has also been migrated (#4543; #4580) - Antonio Sarosi, 2kai2kai2
  • Delete baml.json.encode, which is redundant with baml.json.to_string<unknown>() (#4601) - Antonio Sarosi
  • Drop support for Jinja template literals #"..."#; LLM functions must now use BAML-native template literals ${ipsum()} dolor instead (#4565) - Avery Townsend
  • Drop support for BAML v0 test blocks test ClassifyMessage { functions [Classify1, Classify2] ... }; tests must now be declared with BAML v1 expression bodies test "my test case" { assert.equal(a, b) } (#4602) - Avery Townsend
  • ctx.output_format is now a callable API and must be written as ctx.output_format(). (#4567) - Avery Townsend
  • baml_sdk is now generated in the same directory as baml.toml, instead of the parent directory (#4522) - Sam Lijin
  • The generated C# client is now generated as baml_sdk instead of baml_client (#4535) - Sam Lijin

Fixes

  • Improve LLM response parsing behavior when an optional field is omitted (#4612) - Sam Lijin
  • Make HTTP operations in the playground work again (#4609) - hellovai
  • Preserve errors thrown by code executed by eval() (#4583) - Antonio Sarosi
  • Preserve type definition values at runtime, instead of dropping them or passing them around as strings (#4501; #4516; #4536; #4577) - Antonio Sarosi
  • Make unreflect safe: define its compile-time and runtime behavior, and emit compiler diagnostics in disallowed scenarios (#4518; #4530) - Antonio Sarosi
  • Fix stack-carry compiler optimizations (#4508; #4544) - Sam Lijin, Antonio Sarosi
  • Make match arms for T[] match correctly (#4547) - Avery Townsend
  • Made literal patterns use type-membership semantics instead of value equality. (#4478) - Avery Townsend
  • Prevent compiler crashes on for loops over joined map union arms and on Iterable-bounded generics. (#4490) - Avery Townsend
  • Raise compile errors for empty arrays and maps whose element types cannot be inferred. (#4573) - Avery Townsend
  • Raise compile errors for non-data LLM output schemas instead of crashing or silently erroring. (#4470) - Antonio Sarosi
  • Bring ctx.output_format() to feature parity with BAML v0 (#4567) - Avery Townsend
  • When mutating an object in a called function or a loop, make sure the mutation persists when exiting the context. (#4467) - Antonio Sarosi
  • Fix x?.m<T>() syntax form: thread type args through optional chaining (#4495) - Antonio Sarosi
  • Return a compiler diagnostic when attempting to resolve member variables or call member functions on unknown (#4466) - Antonio Sarosi
  • Return a reflection error, instead of silently failing, when attempting to resolve a generic function defined at runtime (#4473) - Antonio Sarosi
  • Return a compiler diagnostic instead of crashing when type-checking functions with references to undefined types (#4566) - Avery Townsend
  • Enforce runtime type checking of return values when calling functions with reflect.call_any. (#4600) - Antonio Sarosi
  • Emit an error instead of crashing when naming_convention = "language". (#4526) - Sam Lijin
  • baml fmt now removes redundant parentheses. (#4489; #4541) - Avery Townsend, aaronvg
  • Make BAML compile faster: stdlib is now precompiled. (#4453; #4458; #4461; #4463) - Antonio Sarosi
  • LLM stream parsing is now faster: parsing is run on delta batches, instead of per-delta (#4604) - aaronvg

Boundary

Basically a made up language.

  • Company
  • About Us
  • Why BAML?
  • Privacy Policy
  • Terms of Service
  • Resources
  • Docs
  • Jobs
  • Blog
  • Pricing
  • Social
  • GitHub
  • Twitter
  • Discord
  • LinkedIn
  • YouTube