strings
BAML treats strings as first-class citizens, to support more struggle-free prompt engineering.
Quoted Strings
These is a valid inline string, which is surrounded by double quotes. They behave like regular strings in most programming languages, and can be escaped with a backslash.
Unquoted Strings
BAML also supports simple unquoted in-line strings. The string below is valid! These are useful for simple strings such as configuration options.
Unquoted strings may not have any of the following since they are reserved characters (note this may change in the future):
- Quotes “double” or ‘single’
- At-signs @
- Curlies {}
- hashtags #
- Parentheses ()
- Brackets []
- commas ,
- newlines
When in doubt, use a quoted string or a block string, but the VSCode extension will warn you if there is a parsing issue.
Block Strings
If a string is on multiple lines, it must be surrounded by #” and ”#. This is called a block string.
Block strings are automatically dedented and stripped of the first and last newline. This means that the following will render the same thing as above
Code Strings
In case you need to add some code documentation or whatnot in a baml file, you can type this in:
these are not functional code blocks — they are only used for documentation purposes.