Package dev.braintrust.devserver
Class RemoteEval<INPUT,OUTPUT>
java.lang.Object
dev.braintrust.devserver.RemoteEval<INPUT,OUTPUT>
- Type Parameters:
INPUT- The type of input data for the evaluationOUTPUT- The type of output produced by the task
Represents a remote evaluator that can be exposed via the dev server.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <INPUT,OUTPUT>
RemoteEval.Builder<INPUT,OUTPUT> builder()Deprecated.static <INPUT,OUTPUT>
RemoteEval.Builder<INPUT,OUTPUT> Create a builder for an eval whose caseinputandexpectedvalues are deserialized into the given types using the SDK's shared Jackson mapper (seeBraintrustJsonMapper).static <INPUT,OUTPUT>
RemoteEval.Builder<INPUT,OUTPUT> Create a builder for an eval whose caseinputandexpectedvalues are converted with the supplied functions.Converts raw JSON-decodedinputvalues from eval requests intoINPUT.getName()The name of this evaluator (used as identifier)Converts raw JSON-decodedexpectedvalues from eval requests intoOUTPUT.List<ParameterDef<?>>Optional parameter definitions that can be configured from the UIList of scorers for this evaluatorgetTask()The task function that performs the evaluation
-
Method Details
-
builder
public static <INPUT,OUTPUT> RemoteEval.Builder<INPUT,OUTPUT> builder(Class<INPUT> inputClass, Class<OUTPUT> outputClass) Create a builder for an eval whose caseinputandexpectedvalues are deserialized into the given types using the SDK's shared Jackson mapper (seeBraintrustJsonMapper).var eval = RemoteEval.builder(MyInput.class, MyOutput.class) .name("my-eval") .taskFunction(input -> ...) .build();- Parameters:
inputClass- the type to deserialize each case'sinputintooutputClass- the type to deserialize each case'sexpectedinto
-
builder
public static <INPUT,OUTPUT> RemoteEval.Builder<INPUT,OUTPUT> builder(Function<Object, INPUT> inputConverter, Function<Object, OUTPUT> outputConverter) Create a builder for an eval whose caseinputandexpectedvalues are converted with the supplied functions. Converters receive the raw JSON-decoded value (typically aMap<String, Object>,List,String,Number,Boolean, or null) and must tolerate null. Most callers should preferbuilder(Class, Class); use this variant for generic types or custom deserialization.- Parameters:
inputConverter- converts each case's rawinputvalueoutputConverter- converts each case's rawexpectedvalue
-
builder
Deprecated.theINPUTandOUTPUTtype parameters are not applied at runtime, and the task/scorers will receive raw JSON objects, throwingClassCastExceptionunless those types areObjectorMap. Usebuilder(Class, Class)orbuilder(Function, Function)instead.Create a builder with no input/expected deserialization: case values are passed through as raw JSON-decoded objects (e.g.LinkedHashMap). -
getName
The name of this evaluator (used as identifier) -
getTask
The task function that performs the evaluationThe task function must be thread safe.
-
getScorers
List of scorers for this evaluatorThe score function must be thread safe.
-
getParameters
Optional parameter definitions that can be configured from the UI -
getInputConverter
Converts raw JSON-decodedinputvalues from eval requests intoINPUT. Defaults to an unchecked cast of the raw value. -
getOutputConverter
Converts raw JSON-decodedexpectedvalues from eval requests intoOUTPUT. Defaults to an unchecked cast of the raw value.
-
INPUTandOUTPUTtype parameters are not applied at runtime, and the task/scorers will receive raw JSON objects, throwingClassCastExceptionunless those types areObjectorMap.