Ruby SDK for Braintrust observability (tracing, evals, logging).
lib/braintrust/- Main SDK codetrace.rb,trace/- Tracing/spans for LLM callseval.rb,eval/- Evaluation frameworkapi.rb,api/- API clientstate.rb- Global state management
test/- Tests mirror lib/ structureexamples/- Usage examples
rake # Run lint + all appraisal tests (CI)
rake test # Run tests
rake lint # StandardRB linter
rake lint:fix # Auto-fix lint issues
rake -T # List all tasksReproduce the issue in a failing test before fixing it.
Prefer real code over mocks. Use VCR to record/replay HTTP interactions.
rake test # Run with VCR cassettes
VCR_MODE=all rake test # Re-record all cassettes
VCR_MODE=new_episodes rake test # Record new, keep existingThe SDK integrates with optional gems (openai, anthropic, ruby_llm). Tests run against multiple versions:
bundle exec appraisal list # Show scenarios
bundle exec appraisal openai rake test # Test with openai gem
bundle exec appraisal openai-uninstalled rake test # Test withoutUses StandardRB. Run rake lint:fix before committing.