Skip to main content
In this guide we will create a custom LLM judge with CustomEvaluatorExpected. Use this class when each test case has a gold answer (ExpectedResponseContext). Use CustomEvaluatorObjective when you only have pass/fail descriptions (ObjectiveContext). There is no CustomEvaluator class.
Custom evaluators are useful when built-in judges do not cover your rubric, or when you need a specialized scoring scale. See the custom evaluator API for both classes.

Creating a Custom Evaluator

CustomEvaluatorExpected takes a name, judge instructions, a score scale, and a pass threshold. A case fails when the score is below threshold.

Custom Evaluator Parameters

  • name: A descriptive name for your evaluator
  • description: A detailed description of what the evaluator checks
  • instructions: Detailed instructions for the LLM judge on how to evaluate responses
  • threshold: The minimum score needed to pass the evaluation
  • score_range: The range of possible scores (min, max)
  • scores: A list of score definitions with descriptions

Using the Custom Evaluator

Once you’ve created your custom evaluator, you can use it in an evaluation scenario just like any other evaluator:

Saving and Loading Custom Evaluators

Saving custom evaluators is only supported for NeuralTrust type clients currently.
You can save your custom evaluator scenarios to the TrustTest platform for later use:

Complete Example