Skip to main content

Comments

BAML supports several comment styles for documentation and annotation.

Single Line / Trailing Comments​

Use // for single line or trailing comments.

// hello there!
foo // this is a trailing comment

Docstrings​

Use /// to add docstrings to any block. Docstrings are carried through to generated types but are not forwarded to the LLM in prompts.

/// This is a docstring for a class
class Foo {
/// This is a docstring for a property
property1 string
}

Comments in Block Strings​

Inside block strings (prompts), use Jinja comment syntax:

#"
My string. {#
This is a comment that won't appear in the prompt
#}
hi!
"#

See Also​