← all repositories
BoundaryML/baml

Prompts Are Functions, Not Strings

BAML exists because its authors believe maintaining hundreds of f-strings for prompts is disgusting, so they built a typed DSL that compiles LLM functions to your existing language of choice.

8.6k stars Rust LLMOps · EvalAgents
baml
Velocity · 7d
+7.1
★ / day
Trend
accelerating
star history

What it does BAML is a domain-specific language that reframes prompt engineering as schema engineering. You write LLM interactions as typed functions—declaring inputs, outputs, model clients, and retry policies in .baml files—then call them from Python, TypeScript, Ruby, Go, or elsewhere via a Rust-based compiler. It stays strictly in the prompt layer; your application logic never has to migrate.

The interesting bit The team openly admits they invented new syntax because “the idea of maintaining hundreds of f-strings for prompts kind of disgusts us.” Their Schema-Aligned Parsing (SAP) algorithm extracts structured outputs from models that lack native tool-calling support, meaning you can jump between GPT-4o, DeepSeek-R1, or a local Ollama instance by changing one client string without rewriting your schemas.

Key highlights

  • Prompts are functions with full type safety, streaming, and native IDE support for VS Code and JetBrains.
  • Built-in playground runs prompt tests in parallel and visualizes the exact API request, no external logins required.
  • Static fallbacks, retries, and round-robin across hundreds of models, including local Ollama instances.
  • Fully offline and open-source under Apache 2; the compiler makes no network requests beyond the model calls you explicitly configure.
  • Generated clients are fully typed, even for streaming partial responses.

Verdict Reach for BAML if you want maintainable, testable prompts without surrendering your existing stack. Stick with your current setup if a few f-strings and manual JSON parsing already do the job.

Frequently asked

What is BoundaryML/baml?
BAML exists because its authors believe maintaining hundreds of f-strings for prompts is disgusting, so they built a typed DSL that compiles LLM functions to your existing language of choice.
Is baml open source?
Yes — BoundaryML/baml is open source, released under the Apache-2.0 license.
What language is baml written in?
BoundaryML/baml is primarily written in Rust.
How popular is baml?
BoundaryML/baml has 8.6k stars on GitHub and is currently accelerating.
Where can I find baml?
BoundaryML/baml is on GitHub at https://github.com/BoundaryML/baml.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.