Skip to content

Commit b3dd73f

Browse files
authored
Merge pull request #1021 from UiPath/fix/evaluator-folder
fix: use new eval folder
2 parents 26a134d + e2926de commit b3dd73f

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.2.30"
3+
version = "2.2.31"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/_cli/_evals/_evaluator_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
TrajectoryEvaluatorParams,
1818
)
1919
from uipath._cli._evals._models._evaluator_base_params import EvaluatorBaseParams
20-
from uipath._cli._utils._constants import EVALS_DIRECTORY_NAME
20+
from uipath._utils.constants import EVALS_FOLDER
2121
from uipath.eval.evaluators import (
2222
BaseEvaluator,
2323
LegacyBaseEvaluator,
@@ -206,7 +206,7 @@ def _create_coded_evaluator_internal(
206206
# Fall back to the old behavior
207207
file_path = (
208208
Path.cwd()
209-
/ EVALS_DIRECTORY_NAME
209+
/ EVALS_FOLDER
210210
/ "evaluators"
211211
/ "custom"
212212
/ file_path_str

src/uipath/_cli/_evals/_helpers.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import click
1212

1313
from uipath._cli._utils._console import ConsoleLogger
14-
from uipath._cli._utils._constants import EVALS_DIRECTORY_NAME
15-
from uipath._utils.constants import CUSTOM_EVALUATOR_PREFIX
14+
from uipath._utils.constants import CUSTOM_EVALUATOR_PREFIX, EVALS_FOLDER
1615

1716
logger = logging.getLogger(__name__)
1817
console = ConsoleLogger().get_instance()
@@ -37,7 +36,7 @@ def to_kebab_case(text: str) -> str:
3736

3837
def find_evaluator_file(filename: str) -> Path | None:
3938
"""Find the evaluator file in evals/evaluators/custom folder."""
40-
custom_evaluators_path = Path.cwd() / EVALS_DIRECTORY_NAME / "evaluators" / "custom"
39+
custom_evaluators_path = Path.cwd() / EVALS_FOLDER / "evaluators" / "custom"
4140

4241
if not custom_evaluators_path.exists():
4342
return None
@@ -124,7 +123,9 @@ def register_evaluator(filename: str) -> tuple[str, str]:
124123
filename = filename + ".py"
125124
file_path = find_evaluator_file(filename)
126125
if file_path is None:
127-
console.error(f"Could not find '{filename}' in evals/evaluators/custom folder")
126+
console.error(
127+
f"Could not find '{filename}' in {EVALS_FOLDER}/evaluators/custom folder"
128+
)
128129

129130
relative_path = f"evals/evaluators/custom/{filename}"
130131
console.info(
@@ -151,7 +152,7 @@ def register_evaluator(filename: str) -> tuple[str, str]:
151152
evaluator_config = generate_evaluator_config(evaluator_class, class_name)
152153
evaluator_json_type = evaluator_class.generate_json_type()
153154

154-
evaluators_dir = Path.cwd() / EVALS_DIRECTORY_NAME / "evaluators"
155+
evaluators_dir = Path.cwd() / EVALS_FOLDER / "evaluators"
155156
evaluators_dir.mkdir(parents=True, exist_ok=True)
156157

157158
evaluator_types_dir = evaluators_dir / "custom" / "types"
@@ -167,7 +168,7 @@ def register_evaluator(filename: str) -> tuple[str, str]:
167168
json.dump(evaluator_json_type, f, indent=2)
168169

169170
relative_output_path = (
170-
f"evals/evaluators/custom/types/{output_file_evaluator_types}"
171+
f"{EVALS_FOLDER}/evaluators/custom/types/{output_file_evaluator_types}"
171172
)
172173
console.success(
173174
f"Generated evaluator types: {click.style(relative_output_path, fg='cyan')}"

src/uipath/_cli/_utils/_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@
5757
| SPECIAL_EXTENSIONS
5858
)
5959

60-
EVALS_DIRECTORY_NAME = "evals"
61-
6260

6361
def is_binary_file(file_extension: str) -> bool:
6462
"""Determine if a file should be treated as binary."""

src/uipath/_cli/cli_add.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import click
88

9+
from .._utils.constants import EVALS_FOLDER
910
from ._utils._console import ConsoleLogger
10-
from ._utils._constants import EVALS_DIRECTORY_NAME
1111
from ._utils._resources import Resources
1212

1313
logger = logging.getLogger(__name__)
@@ -47,7 +47,7 @@ def generate_evaluator_template(evaluator_name: str) -> str:
4747

4848
def create_evaluator(evaluator_name):
4949
cwd = Path.cwd()
50-
custom_evaluators_dir = cwd / EVALS_DIRECTORY_NAME / "evaluators" / "custom"
50+
custom_evaluators_dir = cwd / EVALS_FOLDER / "evaluators" / "custom"
5151

5252
if not custom_evaluators_dir.exists():
5353
console.info(
@@ -69,7 +69,7 @@ def create_evaluator(evaluator_name):
6969
with open(file_path, "w") as f:
7070
f.write(template_content)
7171

72-
relative_path = f"evals/evaluators/custom/{filename}"
72+
relative_path = f"{EVALS_FOLDER}/evaluators/custom/{filename}"
7373

7474
console.success(f"Created new evaluator: {click.style(relative_path, fg='cyan')}")
7575
console.hint("Next steps:")

src/uipath/agent/utils/_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from httpx import Response
77
from pydantic import TypeAdapter
88

9-
from uipath._cli._utils._constants import (
10-
EVALS_DIRECTORY_NAME,
11-
)
129
from uipath._cli._utils._eval_set import EvalHelpers
1310
from uipath._cli._utils._project_files import pull_project
1411
from uipath._cli._utils._studio_project import (
@@ -18,6 +15,7 @@
1815
StudioSolutionsClient,
1916
resolve_path,
2017
)
18+
from uipath._utils.constants import EVALS_FOLDER
2119
from uipath.agent.models.agent import (
2220
AgentDefinition,
2321
)
@@ -99,7 +97,7 @@ def load_agent_definition(
9997

10098
# Load evaluators from downloaded files
10199
evaluators = []
102-
evaluators_dir = target_project_dir / EVALS_DIRECTORY_NAME / "evaluators"
100+
evaluators_dir = target_project_dir / EVALS_FOLDER / "evaluators"
103101
if evaluators_dir.exists() and evaluators_dir.is_dir():
104102
for file_path in evaluators_dir.glob("*.json"):
105103
try:
@@ -114,7 +112,7 @@ def load_agent_definition(
114112

115113
# Load evaluation sets from downloaded files
116114
evaluation_sets = []
117-
eval_sets_dir = target_project_dir / EVALS_DIRECTORY_NAME / "eval-sets"
115+
eval_sets_dir = target_project_dir / EVALS_FOLDER / "eval-sets"
118116
if eval_sets_dir.exists() and eval_sets_dir.is_dir():
119117
for file_path in eval_sets_dir.glob("*.json"):
120118
evaluation_set, _ = EvalHelpers.load_eval_set(str(file_path))

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)