Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.6.22"
version = "2.6.23"
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"
Expand All @@ -22,6 +22,7 @@ dependencies = [
"coverage>=7.8.2",
"mermaid-builder==0.0.3",
"applicationinsights>=0.11.10",
"pydantic>=2.12.5",
]
classifiers = [
"Intended Audience :: Developers",
Expand Down
11 changes: 0 additions & 11 deletions src/uipath/_cli/_evals/_models/_evaluation_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,3 @@ class EvaluationStatus(IntEnum):
IN_PROGRESS = 1
COMPLETED = 2
FAILED = 3


def _discriminate_eval_set(
v: Any,
) -> Literal["evaluation_set", "legacy_evaluation_set"]:
"""Discriminator function that returns a tag based on version field."""
if isinstance(v, dict):
version = v.get("version")
if version == "1.0":
return "evaluation_set"
return "legacy_evaluation_set"
25 changes: 21 additions & 4 deletions src/uipath/_cli/_utils/_eval_set.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json
from pathlib import Path
from typing import Any

import click
from pydantic import TypeAdapter, ValidationError
from pydantic import ValidationError

from uipath._cli._evals._models._evaluation_set import (
EvaluationItem,
Expand All @@ -19,6 +20,24 @@
EVAL_SETS_DIRECTORY_NAME = "evaluations/eval-sets"


def discriminate_eval_set(data: dict[str, Any]) -> EvaluationSet | LegacyEvaluationSet:
"""Discriminate and parse evaluation set based on version field.

Uses explicit version checking instead of Pydantic's smart union matching
to avoid incorrect type selection when both types have matching fields.

Args:
data: Dictionary containing evaluation set data

Returns:
Either EvaluationSet (for version 1.0) or LegacyEvaluationSet
"""
version = data.get("version")
if version == "1.0":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a weak way to find legacy vs new, We should figure out a better way

return EvaluationSet.model_validate(data)
return LegacyEvaluationSet.model_validate(data)


class EvalHelpers:
@staticmethod
def auto_discover_eval_set() -> str:
Expand Down Expand Up @@ -100,9 +119,7 @@ def load_eval_set(
) from e

try:
eval_set: EvaluationSet | LegacyEvaluationSet = TypeAdapter(
EvaluationSet | LegacyEvaluationSet
).validate_python(data)
eval_set = discriminate_eval_set(data)
if isinstance(eval_set, LegacyEvaluationSet):

def migrate_evaluation_item(
Expand Down
4 changes: 3 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.