Check out the starter repository: https://github.com/BoundaryML/baml-examples/tree/main/python-fastapi-starter
Installation Steps
Install BAML VSCode/Cursor Extension
Install the extension from: https://marketplace.visualstudio.com/items?itemName=boundary.baml-extensionFeatures include:
- Syntax highlighting
- Testing playground
- Prompt previews
Generate the baml_client Module
One of the files in your
baml_src directory will have a generator block. Run this command to auto-generate the baml_client directory with Python code to call your BAML functions.Any types defined in .baml files will be converted into Pydantic models.Using BAML with Jupyter Notebooks
To use BAML in Jupyter notebooks and have your changes automatically reflected:Import as a Module
Instead of using
from baml_client import b, import the module directly:The
%autoreload extension doesn’t work well with from...import statements.