Prompts deserve tests too

Would you ship code without tests? Then why ship prompts without tests? BAML makes prompt testing as natural as unit testing.

Define test cases with test blocks and @@assert. CI/CD for prompts—catch regressions before they hit production.

main.baml
function ClassifyIntent(message: string) -> "question" | "complaint" | "feedback" | "other" {
  client "openai/gpt-4o-mini"
  prompt #"
    Classify the customer intent:
    {{ message }}
    {{ ctx.output_format }}
  "#
}

test ClassifyIntentTests {
  functions [ClassifyIntent]

  args {
    message "How do I reset my password?"
  }
  @@assert {{ result == "question" }}
}

test ComplaintTest {
  functions [ClassifyIntent]

  args {
    message "This product broke after one day!"
  }
  @@assert {{ result == "complaint" }}
}
Click Run to see the rendered prompt