Skip to content

Commit 3a934d1

Browse files
committed
Add result details to llm answer match
1 parent 5b7a00b commit 3a934d1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

evaluators/langevals/langevals_langevals/llm_answer_match.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class LLMAnswerMatchSettings(LLMEvaluatorSettings):
2626

2727

2828
class LLMAnswerMatchResult(EvaluationResult):
29-
passed: bool = Field(default=True)
29+
passed: bool = Field(
30+
description="Whether the predicted answer matches the gold answer", default=True
31+
)
3032
details: Optional[str] = Field(default=None)
3133

3234

@@ -58,7 +60,7 @@ class LLMAnswerMatchEvaluator(
5860

5961
def evaluate(self, entry: LLMAnswerMatchEntry) -> SingleEvaluationResult:
6062
total_tokens = len(
61-
litellm.encode( # type: ignore
63+
litellm.encode( # type: ignore
6264
model=self.settings.model,
6365
text=f"{entry.input} {entry.output} {entry.expected_output}",
6466
)

ts-integration/evaluators.generated.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,11 @@ Uses an LLM to check if the generated output answers a question correctly the sa
12251225
},
12261226
},
12271227
envVars: [],
1228-
result: {},
1228+
result: {
1229+
passed: {
1230+
description: "Whether the predicted answer matches the gold answer",
1231+
},
1232+
},
12291233
},
12301234
"langevals/llm_boolean": {
12311235
name: `LLM-as-a-Judge Boolean Evaluator`,

0 commit comments

Comments
 (0)