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:

enum MyEnum {
  • You may have as many values as you’d like.
  • Values may not be duplicated or empty.
  • Values may not contain spaces or special characters and must not start with a number.