feat(evaluators): allow custom tools on judge-based evaluators (Trajectory, Output, Multimodal) - #324
Conversation
…tEvaluator Adds an optional tools= constructor parameter so the judge agent can call domain-specific verification functions during evaluation. - TrajectoryEvaluator: user tools are merged ahead of the default trajectory scoring tools (exact/in-order/any-order match), which are always retained. - OutputEvaluator: tools default to None, preserving the current no-tools judge. When provided, they are passed to the evaluator Agent in both sync and async paths (and inherited by MultimodalOutputEvaluator subclasses via _create_evaluator_agent). Non-breaking: omitting tools= keeps existing behavior exactly.
|
Assessment: Comment Clean, well-tested, opt-in addition that follows the established Review Categories
Nice use of the existing opt-in convention and thorough backward-compatibility tests. |
|
In the description:
This is incorrect. |
- Move tools after name in both signatures so existing positional callers are unaffected - OutputEvaluator: use public self.tools and pass tools=self.tools directly to Agent (Agent accepts None); drop the _create_evaluator_agent helper - TrajectoryEvaluator: build the merged list with defaults first and custom tools spread after - Forward tools through MultimodalOutputEvaluator and its specialized subclasses so the param is available there too - Tests: assert the exact expected merged tools list instead of the circular evaluator._tools reference; drop the redundant membership assertion
|
Assessment: Approve (pending a doc tidy-up) Re-reviewed at
Verified locally: 52 evaluator tests pass and Two minor, non-blocking follow-ups:
Nice, responsive iteration — this is in good shape. |
|
I see that you've updated other evaluators too, could you update the description / title? |
pdebjyot
left a comment
There was a problem hiding this comment.
Updated the title and description to cover all touched evaluators — the multimodal family (MultimodalOutputEvaluator and its four specialized subclasses) now accepts and forwards tools as well, which their to_dict/from_dict round-trip tests require once the attribute is public. Thanks for the catch.
Closes #322
Description
Adds an optional
tools=constructor parameter so the judge agent can call domain-specific verification functions during evaluation. Follows the same opt-in pattern accepted forToolSimulatorin #208 / #209.Covered evaluators:
TrajectoryEvaluator,OutputEvaluator,MultimodalOutputEvaluator, and its specialized subclasses (MultimodalCorrectnessEvaluator,MultimodalFaithfulnessEvaluator,MultimodalInstructionFollowingEvaluator,MultimodalOverallQualityEvaluator).toolsdefaults toNone, preserving the current no-tools judge (Agentacceptstools=None).MultimodalOutputEvaluatoracceptstoolsand forwards it toOutputEvaluator; the four specialized subclasses accept and forward it likewise, so tool-augmented judging works for multimodal rubrics too.Non-breaking:
toolsis appended afternamein every signature, so existing positional and keyword callers are unaffected; omitting it keeps current behavior exactly.Example
Testing
tools=Nonedefault verified.ruff checkandruff formatclean.Checklist