chore(evaluator): added evaluator name and evaluator_type for report - #249
Merged
poshinchen merged 1 commit intoJun 10, 2026
Merged
Conversation
poshinchen
force-pushed
the
chore/report-evaluator-names
branch
from
June 10, 2026 14:53
e173614 to
c45fd2b
Compare
poshinchen
force-pushed
the
chore/report-evaluator-names
branch
from
June 10, 2026 14:54
c45fd2b to
9ce2afe
Compare
zastrowm
reviewed
Jun 10, 2026
zastrowm
approved these changes
Jun 10, 2026
mehtarac
approved these changes
Jun 10, 2026
jjbuck
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two fixes that make
EvaluationReportrows uniquely identifiable when the same evaluator class is instantiated multiple times in one experiment.1. Evaluator instance names:
Evaluator.__init__now accepts an optionalname=kwarg.get_name()returns the instance name when set, otherwise falls back to the class name.evaluatortag inEvaluationReport.cases(and thegen_ai.evaluation.nameOTel attribute) keys onget_name()so twoContains(value="x")/Contains(value="y")instances no longer collide.Experiment._validate_evaluator_namesrejects duplicates up front with a clear message.Evaluator.to_dict/from_dict.2.
evaluator_typerow tag:evaluator_type(=Evaluator.get_type_name(), the class name) next to the existingevaluatorinstance tag.Containsinstance") without re-deriving the type from the instance name.EvaluationReport.flattenalready usesdict(case), so the field flows through to JSON viato_dict/to_fileautomatically.Surface area is intentionally narrow: no changes to the Rich display, the CLI summary line, or OTel span attributes — those still key on the existing
gen_ai.evaluation.name.Results
Related Issues
Follow-up to the non-blocking nit on #241: #241 (review)
Documentation PR
N/A
Type of Change
Other: small enhancement to evaluator identification + report row schema. Backwards-compatible — existing consumers that read
cases[i]["evaluator"]see the same values;evaluator_typeis purely additive.Testing
New
test_run_evaluations_two_same_class_evaluators_with_distinct_namescovers the doubling scenario from the PR-241 review and now also assertsevaluator_type == "Contains"across both instances.New
test_run_evaluations_rejects_duplicate_evaluator_namescovers the validation path.New
test_evaluator_name_round_trips_through_to_dict_from_dictandtest_evaluator_name_default_omitted_from_to_dictcover serialization.All 111 tests in
tests/strands_evals/test_experiment.pypass locally.I ran
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.