Add authenticated user's orgName to BraintrustConfig#1
Merged
Conversation
Replace hardcoded 'braintrustdata.com' with project.orgId() to ensure the experiment URL is constructed correctly for all environments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix URL construction to use project.name() for the organization identifier in the experiment URL path. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements organization name gathering similar to the Python SDK by calling the /api/apikey/login endpoint during configuration initialization. Key changes: - Add login API method to BraintrustApiClient with proper response models - Enhance BraintrustConfig to automatically retrieve org name during build() - Fix experiment URL generation to use proper org name instead of hardcoded values - Add proper URL encoding for organization names in experiment URLs The implementation follows the Python SDK pattern: - Calls /api/apikey/login endpoint to get user's organization info - Uses the first organization by default if multiple exist - Gracefully handles API failures with warnings rather than breaking builds - No breaking changes to existing code - all BraintrustConfig instances automatically get org name functionality Fixes experiment URLs that previously showed "Optional.empty" to now display the correct organization name (e.g., "Braintrust%20Demos"). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Looks like code formatting failed. I think you can install the pre-commit hooks with and then try committing again |
Replace instanceof pattern matching with traditional cast syntax to ensure compatibility with CI environment's Java version and formatter. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The project requires Java 17+ (configured in build.gradle) but CI was testing against Java 11 which doesn't support record types. Records were introduced in Java 14 preview and stabilized in Java 16. This fixes the spotless formatting errors in CI that were caused by Java 11 not understanding record syntax. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
Looks like the formatter was breaking when using Java 11 but not in 17+ so removed v11. Build is failing but looks like expected values in tests don't include |
Contributor
|
Let me fix the tests in another branch and then will merge it in ehre |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes Made
/api/apikey/loginendpoint with proper response modelsImplementation Details
Test Results
Before:
https://www.braintrust.dev/app/Optional.empty/p/Trivia%20Bot%20Evaluation/experiments/...
After:
https://www.braintrust.dev/app/Braintrust%20Demos/p/Trivia%20Bot%20Evaluation/experiments/...
Test plan