Skip to content

Comments

Move Anthropic and OpenAI into separate nuget packages#19

Open
kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
kevingosse:kgosse/anthropic_nuget
Open

Move Anthropic and OpenAI into separate nuget packages#19
kevingosse wants to merge 2 commits intobraintrustdata:mainfrom
kevingosse:kgosse/anthropic_nuget

Conversation

@kevingosse
Copy link
Contributor

Change the project structure to have three separate nuget package:

  • Braintrust.Sdk
  • Braintrust.Sdk.Anthropic
  • Braintrust.Sdk.OpenAI

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.

Copilot AI review requested due to automatic review settings February 23, 2026 19:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.OpenAI package/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 using directives (System.Diagnostics and Braintrust.Sdk.OpenAI are 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.

Comment on lines 77 to 81
<!-- 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>
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant