Setup
Install LiteLLM alongside the Braintrust SDK:Trace with LiteLLM
Braintrust provides a patch function that automatically instruments LiteLLM to capture all model interactions. Callpatch_litellm() before importing LiteLLM to enable automatic tracing:
trace-litellm.py
- Model calls across different providers
- Request and response data
- Token usage and costs
- Latency metrics
- Error tracking
Resources
- LiteLLM documentation
- DSPy integration - Combines LiteLLM tracing with DSPy-specific callbacks
- Supported providers