Skip to content

chore(evaluator): added evaluator name and evaluator_type for report - #249

Merged
poshinchen merged 1 commit into
strands-agents:mainfrom
poshinchen:chore/report-evaluator-names
Jun 10, 2026
Merged

chore(evaluator): added evaluator name and evaluator_type for report#249
poshinchen merged 1 commit into
strands-agents:mainfrom
poshinchen:chore/report-evaluator-names

Conversation

@poshinchen

@poshinchen poshinchen commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Two fixes that make EvaluationReport rows uniquely identifiable when the same evaluator class is instantiated multiple times in one experiment.

1. Evaluator instance names:

  • Evaluator.__init__ now accepts an optional name= kwarg.
  • get_name() returns the instance name when set, otherwise falls back to the class name.
  • The per-row evaluator tag in EvaluationReport.cases (and the gen_ai.evaluation.name OTel attribute) keys on get_name() so two Contains(value="x") / Contains(value="y") instances no longer collide.
  • Experiment._validate_evaluator_names rejects duplicates up front with a clear message.
  • Store and retrieved through Evaluator.to_dict / from_dict.

2. evaluator_type row tag:

  • Every report row now also carries evaluator_type (= Evaluator.get_type_name(), the class name) next to the existing evaluator instance tag.
    • This lets downstream consumers group/aggregate across all instances of the same class (e.g., "average score across every Contains instance") without re-deriving the type from the instance name.
    • EvaluationReport.flatten already uses dict(case), so the field flows through to JSON via to_dict / to_file automatically.

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

Screenshot 2026-06-10 at 10 56 38 AM

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_type is purely additive.

Testing

  • New test_run_evaluations_two_same_class_evaluators_with_distinct_names covers the doubling scenario from the PR-241 review and now also asserts evaluator_type == "Contains" across both instances.

  • New test_run_evaluations_rejects_duplicate_evaluator_names covers the validation path.

  • New test_evaluator_name_round_trips_through_to_dict_from_dict and test_evaluator_name_default_omitted_from_to_dict cover serialization.

  • All 111 tests in tests/strands_evals/test_experiment.py pass locally.

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@poshinchen
poshinchen force-pushed the chore/report-evaluator-names branch from c45fd2b to 9ce2afe Compare June 10, 2026 14:54
@poshinchen poshinchen changed the title chore(evaluator): added evaluator name chore(evaluator): added evaluator name and evaluator_type for report Jun 10, 2026
Comment thread src/strands_evals/cli/commands/validate.py
@poshinchen
poshinchen merged commit 8981103 into strands-agents:main Jun 10, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants