Back to Baml

Upgrading BAML / Fixing Version Mismatches

fern/01-guide/03-development/upgrade-baml-versions.mdx

0.222.01.6 KB
Original Source

Remember that the generated baml_client code is generated by your baml_py / @boundaryml/baml package dependency (using baml-cli generate), but can also be generated by the VSCode extension when you save a BAML file.

To upgrade BAML versions:

  1. Update the generator clause in your generators.baml file (or wherever you have it defined) to the new version. If you ran baml-cli init, one has already been generated for you!
baml
generator TypescriptGenerator {
    output_type "typescript"
    ....
    // Version of runtime to generate code for (should match the package @boundaryml/baml version)
    version "0.205.0"
}

generator GoGenerator {
    output_type "go"
    ....
    // Version of runtime to generate code for (should match the github.com/boundaryml/baml version)
    version "0.205.0"
}
  1. Update your baml_py / @boundaryml/baml package dependency to the same version.
<CodeBlock> ```sh pip pip install --upgrade baml-py ``` ```sh npm npm install @boundaryml/baml@latest ```
sh
gem install baml
sh
go get -u github.com/boundaryml/baml
</CodeBlock>
  1. Update VSCode BAML extension to point to the same version. Read here for how to keep VSCode in sync with your baml_py / @boundaryml/baml package dependency: VSCode BAML Extension reference

You only need to do this for minor version upgrades (e.g., 0.54.0 -> 0.62.0), not patch versions (e.g., 0.62.0 -> 0.62.1).

Troubleshooting

See the VSCode BAML Extension reference for more information on how to prevent version mismatches.