Skip to content

Add classifier support#154

Merged
Stephen Belanger (Qard) merged 5 commits into
mainfrom
classifiers
May 8, 2026
Merged

Add classifier support#154
Stephen Belanger (Qard) merged 5 commits into
mainfrom
classifiers

Conversation

@Qard

Copy link
Copy Markdown
Contributor

This adds support for classifiers. It tries to align as much as possible with how scorers are implemented currently.

@clutchski

Copy link
Copy Markdown
Contributor

Can you add an example for these?

@Qard

Copy link
Copy Markdown
Contributor Author

Yep, added an example now.

Stephen Belanger (Qard) and others added 2 commits April 22, 2026 15:12
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… via helper

Reverts the blanket `kwargs[:scorers] ||= [...]` added in d80d83c.
Each test that actually runs an eval now explicitly passes `scorers: [noop_scorer]`
where needed. Tests that only exercise validation paths (400/404) are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread lib/braintrust/eval/runner.rb
Mirror the scorer error pattern by pushing classifier failures onto the
errors queue, so they appear in result.errors (and result.success? is
false) in addition to being recorded in span metadata.

Addresses PR #154 review feedback.
@Qard
Stephen Belanger (Qard) merged commit 7afbecf into main May 8, 2026
9 checks passed
@Qard
Stephen Belanger (Qard) deleted the classifiers branch May 8, 2026 23:31
Stephen Belanger (Qard) added a commit to braintrustdata/braintrust-sdk-java that referenced this pull request May 27, 2026
Mirrors the Ruby SDK's classifier port (braintrustdata/braintrust-sdk-ruby#154)
and the canonical classifier spec at braintrust-spec/docs/features/classifiers.md.

Classifiers return structured Classification items (id, optional label,
optional metadata) instead of numeric scores. They run alongside scorers,
their failures are non-fatal, and at least one of scorers/classifiers is
required (relaxes the prior scorers-required check).

New public types: Classification, Classifier (+ Classifier.of / .single
factories), TracedClassifier. Eval gains a classifiers(...) builder method
and a runClassifier helper that emits classifier spans with
type=classifier, purpose=scorer; per-case classifications aggregate onto
the root eval span as braintrust.classifications, and classifier exceptions
land in braintrust.metadata.classifier_errors.

Also fixes an inverted-condition bug in TestHarness.ensureRemoteDataset's
post-rebuild verify check (threw when datasets matched). New cassettes
were recorded only for ClassifierEvalTest (VCR_MODE=record ... --tests
'*ClassifierEvalTest*') against the same Braintrust SDKs org used by the
existing cassettes, so the rest of the cassette set is untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants