Import the instrumentation module before any other module imports
baml_client.b to ensure all functions are decorated.Setup
1) Environment Variables
Create a.env or environment variables in your runtime and set:
.env
2) Create the Keywords AI BAML instrumentation module
Create a module (for examplekeywordsai_baml_tracing.py) that decorates all callable BAML client functions. Import this module first in your app so every BAML call is traced.
keywordsai_baml_tracing.py
3) Use the decorated BAML client
Import the decoratedb from your instrumentation module and use it like your normal BAML client:
app.py