Skip to main content
Reusable prompt specification for CustomJudge evaluators. Provides a structured, validated way to define evaluation prompts with input/output schemas, transforms, and multi-message templates. A CustomJudgeSpec can be defined once and reused across multiple evaluator instances or shared across a codebase.

Parameters

str | list[Message]
required
The evaluation prompt. Can be a plain string (wrapped in a single user message) or a list of Message dicts.
Dict[str, OutputField]
required
Schema defining the expected output fields.
Dict[str, InputFieldSpec] | None
default:"None"
Optional metadata for template variables.
Dict[str, OutputField] | None
default:"None"
Optional schema for the LLM response before transformation. Required when output fields use transform.

Example

Defining a reusable faithfulness evaluator spec:

prompt_template

output_fields

inputs

llm_response_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].