feat: add classifier support#62
Open
Stephen Belanger (Qard) wants to merge 2 commits into
Open
Conversation
Adds the classifiers feature from the spec (braintrust-spec/docs/features/classifiers.md). Classifiers return structured Classification items (id, optional label, optional metadata) keyed by name and run in parallel with scorers. At least one of scorers or classifiers is now required. Includes ITracedClassifier (parallel to ITracedScorer) so classifiers can inspect intermediate trace spans, e.g. to label conversation patterns. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Andrew Kent (realark)
approved these changes
May 27, 2026
Andrew Kent (realark)
approved these changes
May 27, 2026
Collaborator
Andrew Kent (realark)
left a comment
There was a problem hiding this comment.
LGTM! Stephen Belanger (@Qard) DM'd you a question about the example to make but no need to block on it if that's the intended behavior
The Ruby reference implementation (sdk-ruby/lib/braintrust/eval/runner.rb:391, 416-420) uses the classifier name directly as the span name and includes a `name` key in braintrust.span_attributes. Java already follows this pattern (Eval.java:290, 297). .NET was using a "classifier:" prefix on the span name and omitting the name attribute, which prevented consistent classifier-span discovery downstream. Update tests that asserted the prefixed display name; the test helper now identifies classifier spans by their span_attributes.type tag instead of a name prefix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Ports the classifiers feature from the Braintrust spec (and Ruby SDK #154) to the .NET SDK.
Classifiers categorize eval outputs with structured items (
id, optionallabel, optionalmetadata) instead of numeric 0–1 scores. They run in parallel with scorers; at least one of scorers or classifiers is now required.Classification,IClassifier<TInput,TOutput>,FunctionClassifier<TInput,TOutput>,ITracedClassifier<TInput,TOutput>.Eval<TInput,TOutput>.Builder.Classifiers(...)setter; validation message updated to"Must provide at least one scorer or classifier".classifier:<name>,type=classifier purpose=scorer); per-case results aggregated onto the eval span asbraintrust.classifications. Classifier failures are non-fatal — error message merged intobraintrust.metadataunderclassifier_errors..NET-specific extension beyond the spec:
ITracedClassifierparallel to the existingITracedScorer, so classifiers can inspect intermediate trace spans (e.g. label conversation patterns).Test plan
dotnet build Braintrust.Sdk.sln— clean (4 pre-existing warnings, unrelated)dotnet test tests/Braintrust.Sdk.Tests— 125/125 passing, including 20 new classifier factsexamples/ClassifiersExamplebuilds cleandotnet run --project examples/ClassifiersExampleagainst a real Braintrust project and confirm classifications surface in the UI🤖 Generated with Claude Code