Move Anthropic and OpenAI into separate nuget packages#19
Move Anthropic and OpenAI into separate nuget packages#19kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restructures the .NET SDK into separate NuGet packages to isolate provider-specific integrations (OpenAI/Anthropic) from the core Braintrust.Sdk, improving long-term maintainability as more integrations are added.
Changes:
- Introduces a new
Braintrust.Sdk.OpenAIpackage/project (and associated test project) and updates namespaces accordingly. - Removes the OpenAI dependency from the core SDK/test projects and updates examples to reference the new OpenAI project.
- Updates versioning and release automation to build/pack/publish multiple NuGet packages from a single tag.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Braintrust.Sdk.Tests/Braintrust.Sdk.Tests.csproj | Removes direct OpenAI PackageReference from core tests. |
| tests/Braintrust.Sdk.OpenAI.Tests/InstrumentedChatClientTest.cs | Updates imports/namespace for the new OpenAI test project. |
| tests/Braintrust.Sdk.OpenAI.Tests/GlobalUsings.cs | Adds global xUnit using for the OpenAI test project. |
| tests/Braintrust.Sdk.OpenAI.Tests/BraintrustOpenAITest.cs | Updates imports/namespace for the new OpenAI test project. |
| tests/Braintrust.Sdk.OpenAI.Tests/BraintrustGlobalsCollection.cs | Adds shared xUnit collection definition for OpenAI tests. |
| tests/Braintrust.Sdk.OpenAI.Tests/Braintrust.Sdk.OpenAI.Tests.csproj | Adds new OpenAI-specific test project. |
| src/Braintrust.Sdk/Braintrust.Sdk.csproj | Removes OpenAI dependency from core SDK; grants internals access to OpenAI tests. |
| src/Braintrust.Sdk.OpenAI/README.md | Adds README for the new OpenAI integration package. |
| src/Braintrust.Sdk.OpenAI/OpenAITelemetryBuilder.cs | Moves OpenAI telemetry builder into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/OpenAITelemetry.cs | Moves OpenAI telemetry entry point into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/InstrumentedOpenAIClient.cs | Moves OpenAI client wrapper into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/InstrumentedChatClient.cs | Moves ChatClient wrapper into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/BraintrustPipelineTransport.cs | Moves transport wrapper into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/BraintrustOpenAI.cs | Moves public OpenAI integration entry point into the new OpenAI namespace/package. |
| src/Braintrust.Sdk.OpenAI/Braintrust.Sdk.OpenAI.csproj | Adds new OpenAI integration NuGet project/package definition. |
| src/Braintrust.Sdk.Anthropic/README.md | Adds README for the Anthropic integration package. |
| src/Braintrust.Sdk.Anthropic/Braintrust.Sdk.Anthropic.csproj | Packs Anthropic README into the NuGet package. |
| examples/OpenAIInstrumentation/Program.cs | Updates example imports to the new Braintrust.Sdk.OpenAI namespace. |
| examples/OpenAIInstrumentation/OpenAIInstrumentation.csproj | Switches example from direct OpenAI package dependency to OpenAI integration project reference. |
| examples/EvalExample/Program.cs | Updates example imports to the new Braintrust.Sdk.OpenAI namespace. |
| examples/EvalExample/EvalExample.csproj | Switches example from direct OpenAI package dependency to OpenAI integration project reference. |
| Directory.Build.targets | Extends git-derived NuGet versioning to new OpenAI/Anthropic packages. |
| Braintrust.Sdk.sln | Adds new OpenAI package + OpenAI tests projects to the solution. |
| .github/workflows/publish-release-from-tag.yml | Updates release workflow to pack, upload, and publish three NuGet packages. |
Comments suppressed due to low confidence (1)
tests/Braintrust.Sdk.OpenAI.Tests/InstrumentedChatClientTest.cs:4
- This file has unused
usingdirectives (System.DiagnosticsandBraintrust.Sdk.OpenAIare not referenced anywhere below), which will generate compiler warnings and add noise. Please remove the unused imports.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <!-- Set the Version property for NuGet packaging --> | ||
| <PropertyGroup Condition="'$(MSBuildProjectName)' == 'Braintrust.Sdk'"> | ||
| <PropertyGroup Condition="'$(MSBuildProjectName)' == 'Braintrust.Sdk' or '$(MSBuildProjectName)' == 'Braintrust.Sdk.OpenAI' or '$(MSBuildProjectName)' == 'Braintrust.Sdk.Anthropic'"> | ||
| <Version>$(BraintrustSdkVersion)</Version> | ||
| <PackageVersion>$(BraintrustSdkVersion)</PackageVersion> | ||
| </PropertyGroup> |
There was a problem hiding this comment.
ComputeBraintrustVersion now sets Version/PackageVersion for the new Braintrust.Sdk.OpenAI and Braintrust.Sdk.Anthropic packages, but the later VerifyAssemblyVersion target still only runs for Braintrust.Sdk. This means the new packages won’t get the same safeguard against version mismatches (e.g., if Version is overridden or the embedded version resource diverges). Consider expanding the VerifyAssemblyVersion target condition to include the new package projects as well, or factoring the condition into a shared property so all packable SDK packages are verified consistently.
Change the project structure to have three separate nuget package:
Keeping everything into a single package would not be sustainable as the number of supported libraries increase.
Obviously this is a pretty big breaking change.