The plan mentions supporting both global and local state.
|
```ruby |
|
# Simple case - sets global state (default) |
|
Braintrust.init( |
|
api_key: ENV['BRAINTRUST_API_KEY'], |
|
project: "my-project" |
|
) |
|
|
|
# Explicit state (for testing, multi-tenant) |
|
state = Braintrust.init( |
|
api_key: "key", |
|
project: "project", |
|
set_global: false |
|
) |
This is a very good pattern.
But currently, only global seems to be supported. At least that's all that's in the readme.
Also, if you support local state, I would suggest the traditional class pattern with new (idiomatic ruby):
# Simple case - sets global state (default)
Braintrust.init(
api_key: ENV['BRAINTRUST_API_KEY'],
project: "my-project"
)
# Explicit state (for testing, multi-tenant)
braintrust_instance = Braintrust.new(
api_key: "key",
project: "project",
set_global: false
)
(the one in the plan is even broken, it wouldn't work at all as mentioned in the plan)
The plan mentions supporting both global and local state.
braintrust-sdk-ruby/.plan/.PLAN.md
Lines 16 to 28 in 1929a20
This is a very good pattern.
But currently, only global seems to be supported. At least that's all that's in the readme.
Also, if you support local state, I would suggest the traditional class pattern with
new(idiomatic ruby):(the one in the plan is even broken, it wouldn't work at all as mentioned in the plan)