fern/03-reference/baml-cli/generate.mdx
The generate command is used to generate BAML clients based on your BAML source files. It processes the BAML configurations and creates the necessary client code for your specified output type.
baml-cli generate [OPTIONS]
| Option | Description | Default |
|---|---|---|
--from <PATH> | Path to the baml_src directory | ./baml_src |
--no-version-check | Generate baml_client without checking for version mismatch | false |
--no-tests | Strip test blocks from inlined BAML to reduce generated file size | false |
The generate command performs the following actions:
generators.baml).baml_client based on the generator configurations.Generate clients using default settings:
baml-cli generate
Generate clients from a specific directory:
baml-cli generate --from /path/to/my/baml_src
Generate clients without version check:
baml-cli generate --no-version-check
Generate clients without test blocks (reduces file size):
baml-cli generate --no-tests
The command provides informative output about the generation process:
--no-tests flag is useful for production builds where you want to minimize the generated client size. When enabled, test blocks defined in your BAML files are not included in the generated baml_client, reducing bundle size without affecting runtime functionality.