Enums are useful for classification tasks. BAML has helper functions that can help you serialize an enum into your prompt in a neatly formatted list (more on that later).
To define your own custom enum in BAML:
This is the name of the enum rendered in the prompt.
If set, will allow you to add/remove/modify values to the enum dynamically at runtime (in your python/ts/etc code). See dynamic enums for more information.
When prompt engineering, you can also alias values and add descriptions, or even skip them.
Aliasing renames the values for the llm to potentially “understand” your value better, while keeping the original name in your code, so you don’t need to change your downstream code everytime.
This will also be used for parsing the output of the LLM back into the enum.
This adds some additional context to the value in the prompt.
Skip this value in the prompt and during parsing.
See more in prompt syntax docs