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.
// 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 }}
"#
}