Tutorials & Guides
Custom LLM as a Judge
In this guide we will see how to create and configure a custom Evaluator
using the CustomEvaluator class. This allows easly define your onw LLM as a judge for specific use cases.
Custom evaluators are particularly useful when you need to evaluate specific aspects of LLM responses that aren’t covered by the built-in evaluators, or when you need a specialized scoring system for your use case.
Creating a Custom Evaluator
The CustomEvaluator
class allows you to define your own evaluation criteria with a custom scoring system. Here’s how to create one:
Custom Evaluator Parameters
name
: A descriptive name for your evaluatordescription
: A detailed description of what the evaluator checksinstructions
: Detailed instructions for the LLM judge on how to evaluate responsesthreshold
: The minimum score needed to pass the evaluationscore_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: