BAML
A DSL for typed LLM functions with reliable structured outputs.
About
BAML (Basically A Made-up Language) is a domain-specific language from BoundaryML for defining LLM functions with typed inputs and outputs. You declare classes and enums, write the prompt as a Jinja template, and baml-cli generate produces a typed client in Python, TypeScript, Go, or Ruby. At runtime, Schema-Aligned Parsing coerces whatever the model returns into your schema, repairing common malformed output without JSON mode or retry loops. A VS Code extension provides a prompt playground with live preview and auto-regeneration on save.
The pitch is the reliability of typed outputs without hand-writing response_format JSON, escaping schemas into prompt strings, or regex-repairing broken JSON. Independent benchmarks have shown it outperforming raw Pydantic-based extraction on structured-output reliability.
Honest caveats: the product is between generations. The conventional framework line (0.222.0, April 2026) is giving way to a broader 'programming language for agents' toolchain that is pre-1.0, and the SDK support matrix labels Python and TypeScript beta, Go and Rust alpha. It is a strong choice for schema-heavy LLM applications today, but standardizing a fleet on it means betting on the new language line stabilizing.
What it can do
- Typed LLM functions: prompts as functions with schema return types
- Schema-Aligned Parsing repairs malformed model output automatically
- Generated typed clients for Python, TypeScript, Go, and Ruby
- Streaming structured outputs with full type safety
- VS Code playground with live prompt preview and prompt tests
Setup
pip install baml-py or npm install @boundaryml/baml, define functions in baml_src/, then run baml-cli generate.
Prerequisites
An LLM provider API key in your environment; Python 3.8+ or Node 18+.
Use cases
Works with
Trust score — 8/10
Scored 8/10 (verified tier, metrics-v1). Evidence: Verified via vendor site/docs/GitHub and reputable coverage, wave 74; Trending score 76/100 from researcher assessment.
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.