Class ScorerBrainstoreImpl<INPUT,OUTPUT>

java.lang.Object
dev.braintrust.eval.ScorerBrainstoreImpl<INPUT,OUTPUT>
All Implemented Interfaces:
Scorer<INPUT,OUTPUT>

public class ScorerBrainstoreImpl<INPUT,OUTPUT> extends Object implements Scorer<INPUT,OUTPUT>
A scorer that invokes a remote Braintrust function to compute scores.

This implementation fetches a scorer function from Braintrust and invokes it via the API for each task result. The remote function receives the input, output, expected, and metadata as arguments.

Supports distributed tracing: if an object ID is available in OTEL baggage and a valid span context exists, the scorer will pass parent span information to the remote function, enabling the remote function's spans to appear as children of the local scorer span.

  • Constructor Details

    • ScorerBrainstoreImpl

      public ScorerBrainstoreImpl(BraintrustApiClient apiClient, String functionId, @Nullable String version)
      Create a new remote scorer.
      Parameters:
      apiClient - the API client to use for invoking the function
      functionId - braintrust function id
      version - optional version of the function to invoke. null always invokes latest version.
  • Method Details