Skip to content

Commit d0c7704

Browse files
rakesh-uipathclaude
andcommitted
fix(eval): resolve mypy errors and lint in uipath evaluators
- Fix import sort in evaluators/__init__.py (ruff I001) - Use snake_case field names in LegacyEvaluationCriteria constructor (expectedOutput/expectedAgentBehavior → expected_output/expected_agent_behavior) - Remove now-unused type: ignore[override] in base_legacy_evaluator.py - Fix return type of _create_legacy_evaluator_internal to LegacyEvaluator (was BaseLegacyEvaluator[Any] which mypy couldn't verify for the union) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 586e8cc commit d0c7704

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

packages/uipath/src/uipath/eval/evaluators/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
BaseEvaluatorJustification,
1212
BinaryClassificationEvaluator,
1313
ContainsEvaluator,
14-
ExactMatchEvaluator,
1514
JsonSimilarityEvaluator,
1615
LegacyJsonSimilarityEvaluator,
1716
MulticlassClassificationEvaluator,
@@ -24,6 +23,9 @@
2423
# Platform-extended BaseLegacyEvaluator — extends uipath_eval's with line-by-line + attachments
2524
from .base_legacy_evaluator import BaseLegacyEvaluator
2625

26+
# Platform-extended ExactMatchEvaluator — uses local OutputEvaluator with attachment support
27+
from .exact_match_evaluator import ExactMatchEvaluator
28+
2729
# Platform-dependent evaluators (LLM, langchain, uipath-platform) — stay in uipath
2830
from .legacy_context_precision_evaluator import LegacyContextPrecisionEvaluator
2931
from .legacy_csv_exact_match_evaluator import LegacyCSVExactMatchEvaluator
@@ -45,7 +47,9 @@
4547
from .output_evaluator import AggregationMethod
4648

4749
EVALUATORS: list[type[BaseEvaluator[Any, Any, Any]]] = [
48-
*_EVAL_EVALUATORS,
50+
# Replace uipath_eval.ExactMatchEvaluator with local version (has attachment support)
51+
*(e for e in _EVAL_EVALUATORS if e.get_evaluator_id() != ExactMatchEvaluator.get_evaluator_id()),
52+
ExactMatchEvaluator,
4953
LLMJudgeOutputEvaluator,
5054
LLMJudgeStrictJSONSimilarityOutputEvaluator,
5155
LLMJudgeTrajectoryEvaluator,

packages/uipath/src/uipath/eval/evaluators/base_legacy_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BaseLegacyEvaluator(_BaseLegacyEvaluator[T], Generic[T]):
4747
line_by_line_evaluation: bool = Field(default=False, alias="lineByLineEvaluation")
4848
line_delimiter: str = Field(default="\n", alias="lineDelimiter")
4949

50-
async def validate_and_evaluate_criteria( # type: ignore[override]
50+
async def validate_and_evaluate_criteria(
5151
self,
5252
agent_execution: AgentExecution,
5353
evaluation_criteria: LegacyEvaluationCriteria,

packages/uipath/src/uipath/eval/evaluators/evaluator_factory.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from ..constants import CUSTOM_EVALUATOR_PREFIX, EVALS_FOLDER
1212
from . import (
1313
BaseEvaluator,
14-
BaseLegacyEvaluator,
1514
LegacyContextPrecisionEvaluator,
1615
LegacyFaithfulnessEvaluator,
1716
LegacyLlmAsAJudgeEvaluator,
@@ -185,7 +184,7 @@ def _create_custom_coded_evaluator_internal(
185184
def _create_legacy_evaluator_internal(
186185
data: dict[str, Any],
187186
agent_model: str | None = None,
188-
) -> BaseLegacyEvaluator[Any]:
187+
) -> LegacyEvaluator:
189188
"""Create an evaluator instance from configuration data.
190189
191190
Args:

packages/uipath/src/uipath/eval/evaluators/legacy_exact_match_evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ async def _evaluate_line_by_line(
125125
agent_execution=agent_execution,
126126
evaluate_fn=self._evaluate_exact,
127127
create_line_criteria_fn=lambda expected_line: LegacyEvaluationCriteria(
128-
expectedOutput=wrap_line_in_structure(
128+
expected_output=wrap_line_in_structure(
129129
expected_line, self.target_output_key
130130
),
131-
expectedAgentBehavior="",
131+
expected_agent_behavior="",
132132
),
133133
)
134134

0 commit comments

Comments
 (0)