baml 0.216.0

BAML runtime for Rust - type-safe LLM function calls
Documentation

baml

BAML runtime for Rust - Type-safe LLM function calls.

This crate provides the runtime support for BAML-generated Rust code. Users should not import from this crate directly - instead, use the generated baml_client crate which re-exports necessary types.

Features

  • Type-safe LLM function calls
  • Async streaming support
  • Runtime client registry
  • Dynamic type encoding/decoding
  • Error handling and diagnostics

Usage

This crate is typically used as a dependency by code generated by the BAML compiler. For usage instructions, see the BAML documentation.

Runtime Requirements

The BAML runtime requires the libbaml_cffi dynamic library at runtime. The library is:

  • Auto-downloaded from GitHub releases on first use (default behavior)
  • Cached in your user cache directory (~/.cache/baml/libs/ on Linux, ~/Library/Caches/baml/libs/ on macOS)
  • Configurable via environment variables

To disable auto-download (e.g., in air-gapped environments):

export BAML_LIBRARY_DISABLE_DOWNLOAD=true
export BAML_LIBRARY_PATH=/path/to/libbaml_cffi.dylib

License

Apache License - see the Repository for details.