Skills / Engineering / BAML Structured LLM Outputs

BAML Structured LLM Outputs

Build typed, testable LLM functions with BAML — a DSL that compiles prompts into typesafe clients for TypeScript, Python, and Ruby. Handles schema-aligned parsing, function definitions, retries, and playground testing.

This skill helps you adopt BAML (Boundary's domain language for LLM prompts) in production codebases. It generates .baml files for typed function definitions, configures generators for your target language, writes test cases with sample inputs, sets up streaming with partial parsing, and migrates fragile JSON-mode prompts into resilient schema-aligned parsing. Covers Boundary's playground workflow, version control patterns, and CI integration.

baml llm structured-output typescript python

When to use

Use when you need typed structured outputs from LLMs, want to replace brittle JSON-mode prompts, are building agent workflows that need reliable parsing, or need a prompt testing workflow your team can review like code.

Examples

Extract structured data

Generate a BAML function for resume parsing

Create a BAML function that extracts structured candidate data (name, skills, experience array, education) from raw resume text, with TypeScript client generation

Migrate JSON-mode prompts

Convert existing OpenAI JSON-mode calls to BAML

Migrate my OpenAI JSON-mode prompt for product categorization into a BAML function with proper test cases and retry strategy
Added to wishlist