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 picker
defaultValue - optional default value used when the request does not include this parameter
description - optional human-readable description shown in the Playground UI
schema - 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.

  • 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 a ParameterDef record class.
      Parameters:
      name - the value for the name record component
      type - the value for the type record component
      defaultValue - the value for the defaultValue record component
      description - the value for the description record component
      schema - the value for the schema record component
  • Method Details

    • data

      public static <T> ParameterDef<T> data(@Nonnull String name, @Nonnull T defaultValue)
    • 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

      public static ParameterDef<String> model(String name, String defaultValue)
      Create a model parameter definition. The default value is a model name string.
    • model

      public static ParameterDef<String> model(String name, String defaultValue, String description)
      Create a model parameter definition with a description.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      @Nonnull public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      @Nonnull public ParameterDef.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • defaultValue

      @Nullable public T defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component
    • description

      @Nullable public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • schema

      @Nullable public Map<String,Object> schema()
      Returns the value of the schema record component.
      Returns:
      the value of the schema record component