Class GEvalEvaluator
java.lang.Object
com.tnsai.evaluation.evaluators.geval.GEvalEvaluator
- All Implemented Interfaces:
Evaluator
G-Eval: LLM-as-judge evaluator using a 2-step chain-of-thought process.
Step 1: The LLM generates intermediate evaluation steps (CoT) for the given criteria. Step 2: Using those steps, the LLM scores the agent's response on a 1-5 scale, which is normalized to [0.0, 1.0].
Based on the G-Eval paper (Liu et al., 2023) — "G-Eval: NLG Evaluation using GPT-4 with Better Human Alignment".
Usage
LLMJudge judge = prompt -> myLlmClient.chat(prompt);
var evaluator = new GEvalEvaluator("coherence",
"Does the response maintain logical flow and consistency?", judge);
EvaluationResult result = evaluator.evaluate(input);
- Since:
- 0.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.evaluation.spi.Evaluator
Evaluator.EvaluationInput -
Constructor Summary
ConstructorsConstructorDescriptionGEvalEvaluator(String criteriaName, String criteriaDescription, LLMJudge judge) Creates a G-Eval evaluator for a specific evaluation criteria. -
Method Summary
Modifier and TypeMethodDescriptionevaluate(Evaluator.EvaluationInput context) Evaluates agent behavior for a single interaction.name()Unique name for this evaluator.
-
Constructor Details
-
GEvalEvaluator
Creates a G-Eval evaluator for a specific evaluation criteria.- Parameters:
criteriaName- short identifier for this criteria (e.g. "coherence")criteriaDescription- human-readable description of what to evaluatejudge- LLM function used for chain-of-thought judging
-
-
Method Details