BAML fits into your stack—you don't rewrite for BAML

This is the "incrementally adoptable" promise. See BAML called from TypeScript, Python, and more.

Write once in BAML. Call from anywhere. Types flow through with IDE autocomplete in every language.

main.baml
// BAML Definition
function AnalyzeSentiment(reviews: string[]) -> { positive: int, negative: int, neutral: int } {
  client "openai/gpt-4o-mini"
  prompt #"
    Analyze these reviews:
    {% for review in reviews %}
    - {{ review }}
    {% endfor %}

    Count how many are positive, negative, and neutral.
    {{ ctx.output_format }}
  "#
}
Click Run to see the rendered prompt