Skip to navigation

generator

Each generator that you define in your BAML project will tell baml-cli generate to generate code for a specific target language. You can define multiple generator clauses in your BAML project, and baml-cli generate will generate code for each of them.

If you created your project using baml-cli init, then one has already been generated for you!
generator target {
output_type "python/pydantic"
// Where the generated code will be saved (relative to baml_src/)
output_dir "../"
// What interface you prefer to use for the generated code (sync/async)
// Both are generated regardless of the choice, just modifies what is exported
// at the top level
default_client_mode "sync"
// Version of runtime to generate code for (should match installed baml-py version)
version "0.76.2"
}