From e990cd01a9123b55068c81069dcc552609a0ea48 Mon Sep 17 00:00:00 2001 From: Andrei Rusu Date: Tue, 24 Feb 2026 13:38:51 +0200 Subject: [PATCH 1/2] fix(evals): exact match float int mismatch --- .../eval/evaluators/exact_match_evaluator.py | 11 ++-- tests/evaluators/test_evaluator_methods.py | 61 +++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/src/uipath/eval/evaluators/exact_match_evaluator.py b/src/uipath/eval/evaluators/exact_match_evaluator.py index 5cad0670b..cd422eb23 100644 --- a/src/uipath/eval/evaluators/exact_match_evaluator.py +++ b/src/uipath/eval/evaluators/exact_match_evaluator.py @@ -58,11 +58,14 @@ async def evaluate( """ actual_output = str(self._get_actual_output(agent_execution)) expected_output = str(self._get_expected_output(evaluation_criteria)) - if not self.evaluator_config.case_sensitive: - actual_output = actual_output.lower() - expected_output = expected_output.lower() - is_exact_match = actual_output == expected_output + try: + is_exact_match = float(actual_output) == float(expected_output) + except ValueError: + if not self.evaluator_config.case_sensitive: + actual_output = actual_output.lower() + expected_output = expected_output.lower() + is_exact_match = actual_output == expected_output if self.evaluator_config.negated: is_exact_match = not is_exact_match diff --git a/tests/evaluators/test_evaluator_methods.py b/tests/evaluators/test_evaluator_methods.py index 7b09fb8d7..3aaa99368 100644 --- a/tests/evaluators/test_evaluator_methods.py +++ b/tests/evaluators/test_evaluator_methods.py @@ -199,6 +199,67 @@ async def test_exact_match_negated( assert isinstance(result, NumericEvaluationResult) assert result.score == 0.0 + @pytest.mark.asyncio + @pytest.mark.parametrize( + "actual, expected", + [ + ("1.0", "1"), + ("1", "1.0"), + ("1e0", "1"), + ("1.00", "1.0"), + ("0.5", "0.50"), + ("-3.0", "-3"), + ], + ) + async def test_exact_match_numeric_leniency( + self, actual: str, expected: str + ) -> None: + """Test that numerically equal values match regardless of string representation.""" + execution = AgentExecution( + agent_input={"input": "Test"}, + agent_output={"result": actual}, + agent_trace=[], + ) + config = { + "name": "ExactMatchNumericTest", + "case_sensitive": True, + "target_output_key": "result", + } + evaluator = ExactMatchEvaluator.model_validate( + {"evaluatorConfig": config, "id": str(uuid.uuid4())} + ) + criteria = OutputEvaluationCriteria(expected_output={"result": expected}) # pyright: ignore[reportCallIssue] + + result = await evaluator.evaluate(execution, criteria) + + assert isinstance(result, NumericEvaluationResult) + assert result.score == 1.0, ( + f"Expected '{actual}' and '{expected}' to be considered equal as numbers" + ) + + @pytest.mark.asyncio + async def test_exact_match_numeric_non_equal(self) -> None: + """Test that numerically different values do not match.""" + execution = AgentExecution( + agent_input={"input": "Test"}, + agent_output={"result": "1.5"}, + agent_trace=[], + ) + config = { + "name": "ExactMatchNumericTest", + "case_sensitive": True, + "target_output_key": "result", + } + evaluator = ExactMatchEvaluator.model_validate( + {"evaluatorConfig": config, "id": str(uuid.uuid4())} + ) + criteria = OutputEvaluationCriteria(expected_output={"result": "1"}) # pyright: ignore[reportCallIssue] + + result = await evaluator.evaluate(execution, criteria) + + assert isinstance(result, NumericEvaluationResult) + assert result.score == 0.0 + @pytest.mark.asyncio async def test_exact_match_validate_and_evaluate_criteria( self, sample_agent_execution: AgentExecution From 73395d31c5b0dec4cb5d21e5f0d7a7fe58940bd3 Mon Sep 17 00:00:00 2001 From: Andrei Rusu Date: Tue, 24 Feb 2026 15:46:59 +0200 Subject: [PATCH 2/2] fix(evals): bump version --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c796a2073..a9032f2ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.9.3" +version = "2.9.4" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/uv.lock b/uv.lock index e108fcc76..ecd62cd50 100644 --- a/uv.lock +++ b/uv.lock @@ -2531,7 +2531,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.9.3" +version = "2.9.4" source = { editable = "." } dependencies = [ { name = "applicationinsights" },