Package dev.braintrust.eval
Record Class ParameterDef<T>
java.lang.Object
java.lang.Record
dev.braintrust.eval.ParameterDef<T>
- Record Components:
name- the parameter name (used as the key in the merged parameters map)type- the parameter type:"data"for generic values,"model"for a model pickerdefaultValue- optional default value used when the request does not include this parameterdescription- optional human-readable description shown in the Playground UIschema- optional JSON Schema fragment describing the value shape (e.g.,{"type": "string"}). Only applicable for"data"type parameters.
public record ParameterDef<T>(@Nonnull String name, @Nonnull ParameterDef.Type type, @Nullable T defaultValue, @Nullable String description, @Nullable Map<String,Object> schema)
extends Record
Definition of a named parameter that can be configured from the Braintrust Playground UI.
Parameter definitions declare what parameters an evaluator accepts, their types, defaults, and descriptions. The Playground uses these to render appropriate UI controls.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionParameterDef(String name, ParameterDef.Type type, T defaultValue, String description, Map<String, Object> schema) Creates an instance of aParameterDefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ParameterDef<T>Create a data parameter definition with an explicit value class (for when no default is provided or the type can't be inferred from the default).static <T> ParameterDef<T>static <T> ParameterDef<T>Returns the value of thedefaultValuerecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ParameterDef<String>Create a model parameter definition.static ParameterDef<String>Create a model parameter definition with a description.name()Returns the value of thenamerecord component.schema()Returns the value of theschemarecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
ParameterDef
public ParameterDef(@Nonnull String name, @Nonnull ParameterDef.Type type, @Nullable T defaultValue, @Nullable String description, @Nullable Map<String, Object> schema) Creates an instance of aParameterDefrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componentdefaultValue- the value for thedefaultValuerecord componentdescription- the value for thedescriptionrecord componentschema- the value for theschemarecord component
-
-
Method Details
-
data
-
data
public static <T> ParameterDef<T> data(@Nonnull String name, @Nonnull T defaultValue, @Nullable String description) -
data
public static <T> ParameterDef<T> data(@Nonnull String name, @Nonnull Class<? extends T> valueClass, @Nullable T defaultValue, @Nullable String description) Create a data parameter definition with an explicit value class (for when no default is provided or the type can't be inferred from the default).- Parameters:
valueClass- the Java class of the parameter value (e.g.,String.class,Map.class)
-
model
Create a model parameter definition. The default value is a model name string. -
model
Create a model parameter definition with a description. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
schema
Returns the value of theschemarecord component.- Returns:
- the value of the
schemarecord component
-