Skip to main content
Secure Code Sandboxes & Agent RuntimesOpen SourceType-Safe AI DSL

BAML

Type-safe prompt programming language & LLM function compiler

BAML is a domain-specific language that turns complex LLM prompts into strongly-typed functions with automatic client generation.

Quickstart Execution

extract.baml

Get started with BAML in your project.

// Define structured types in BAML
class DanishCompany {
  name string
  cvr int
  industry string
}

function ExtractCompany(text: string) -> DanishCompany {
  client GPT4o
  prompt #"
    Extract the Danish company details:
    {{ text }}
    {{ ctx.output_format }}
  "#
}

About BAML

BAML (Basically A Made-up Language) brings software engineering rigor to prompt engineering. Write typed schemas and prompts in `.baml` files, test them with live preview in VS Code, and compile them into zero-overhead, type-safe clients for Python, TypeScript, and Go.

DK

Danish Product & Data Recipes

How developers and agents use BAML to connect with Danish digital infrastructure.

Compile Type-Safe Danish Address & CPR Parsing Functions

Define strict BAML schemas for Danish municipal forms and generate TypeScript clients that parse messy user inputs with guaranteed types.

Key Capabilities

Compiles prompts into native TypeScript, Python, and Go SDKs
4x token savings over verbose JSON schema formats
Schema-Aligned Parsing (SAP) heals malformed LLM responses
Interactive VS Code playground with hot-reloading testing