uipath 2.1.76__py3-none-any.whl → 2.1.77__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uipath/eval/evaluators/trajectory_evaluator.py +6 -2
- uipath/eval/models/models.py +110 -1
- {uipath-2.1.76.dist-info → uipath-2.1.77.dist-info}/METADATA +1 -1
- {uipath-2.1.76.dist-info → uipath-2.1.77.dist-info}/RECORD +7 -8
- uipath/_cli/_evals/_models/_trajectory_span.py +0 -115
- {uipath-2.1.76.dist-info → uipath-2.1.77.dist-info}/WHEEL +0 -0
- {uipath-2.1.76.dist-info → uipath-2.1.77.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.76.dist-info → uipath-2.1.77.dist-info}/licenses/LICENSE +0 -0
@@ -6,12 +6,16 @@ from typing import Any, Optional
|
|
6
6
|
from opentelemetry.sdk.trace import ReadableSpan
|
7
7
|
from pydantic import field_validator
|
8
8
|
|
9
|
-
from uipath._cli._evals._models._trajectory_span import TrajectoryEvaluationTrace
|
10
9
|
from uipath.eval.models import EvaluationResult
|
11
10
|
|
12
11
|
from ..._services import UiPathLlmChatService
|
13
12
|
from ..._utils.constants import COMMUNITY_agents_SUFFIX
|
14
|
-
from ..models.models import
|
13
|
+
from ..models.models import (
|
14
|
+
AgentExecution,
|
15
|
+
LLMResponse,
|
16
|
+
NumericEvaluationResult,
|
17
|
+
TrajectoryEvaluationTrace,
|
18
|
+
)
|
15
19
|
from .base_evaluator import BaseEvaluator
|
16
20
|
|
17
21
|
|
uipath/eval/models/models.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
"""Models for evaluation framework including execution data and evaluation results."""
|
2
2
|
|
3
|
+
from dataclasses import dataclass
|
3
4
|
from enum import IntEnum
|
4
|
-
from typing import Annotated, Any, Dict, Literal, Optional, Union
|
5
|
+
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
|
5
6
|
|
6
7
|
from opentelemetry.sdk.trace import ReadableSpan
|
7
8
|
from pydantic import BaseModel, ConfigDict, Field
|
@@ -113,3 +114,111 @@ class EvaluatorType(IntEnum):
|
|
113
114
|
return cls(value)
|
114
115
|
else:
|
115
116
|
raise ValueError(f"{value} is not a valid EvaluatorType value")
|
117
|
+
|
118
|
+
|
119
|
+
@dataclass
|
120
|
+
class TrajectoryEvaluationSpan:
|
121
|
+
"""Simplified span representation for trajectory evaluation.
|
122
|
+
|
123
|
+
Contains span information needed for evaluating agent execution paths,
|
124
|
+
excluding timestamps which are not useful for trajectory analysis.
|
125
|
+
"""
|
126
|
+
|
127
|
+
name: str
|
128
|
+
status: str
|
129
|
+
attributes: Dict[str, Any]
|
130
|
+
parent_name: Optional[str] = None
|
131
|
+
events: Optional[List[Dict[str, Any]]] = None
|
132
|
+
|
133
|
+
def __post_init__(self):
|
134
|
+
"""Initialize default values."""
|
135
|
+
if self.events is None:
|
136
|
+
self.events = []
|
137
|
+
|
138
|
+
@classmethod
|
139
|
+
def from_readable_span(
|
140
|
+
cls, span: ReadableSpan, parent_spans: Optional[Dict[int, str]] = None
|
141
|
+
) -> "TrajectoryEvaluationSpan":
|
142
|
+
"""Convert a ReadableSpan to a TrajectoryEvaluationSpan.
|
143
|
+
|
144
|
+
Args:
|
145
|
+
span: The OpenTelemetry ReadableSpan to convert
|
146
|
+
parent_spans: Optional mapping of span IDs to names for parent lookup
|
147
|
+
|
148
|
+
Returns:
|
149
|
+
TrajectoryEvaluationSpan with relevant data extracted
|
150
|
+
"""
|
151
|
+
# Extract status
|
152
|
+
status_map = {0: "unset", 1: "ok", 2: "error"}
|
153
|
+
status = status_map.get(span.status.status_code.value, "unknown")
|
154
|
+
|
155
|
+
# Extract attributes - keep all attributes for now
|
156
|
+
attributes = {}
|
157
|
+
if span.attributes:
|
158
|
+
attributes = dict(span.attributes)
|
159
|
+
|
160
|
+
# Get parent name if available
|
161
|
+
parent_name = None
|
162
|
+
if span.parent and parent_spans and span.parent.span_id in parent_spans:
|
163
|
+
parent_name = parent_spans[span.parent.span_id]
|
164
|
+
|
165
|
+
# Extract events (without timestamps)
|
166
|
+
events = []
|
167
|
+
if hasattr(span, "events") and span.events:
|
168
|
+
for event in span.events:
|
169
|
+
event_data = {
|
170
|
+
"name": event.name,
|
171
|
+
"attributes": dict(event.attributes) if event.attributes else {},
|
172
|
+
}
|
173
|
+
events.append(event_data)
|
174
|
+
|
175
|
+
return cls(
|
176
|
+
name=span.name,
|
177
|
+
status=status,
|
178
|
+
attributes=attributes,
|
179
|
+
parent_name=parent_name,
|
180
|
+
events=events,
|
181
|
+
)
|
182
|
+
|
183
|
+
def to_dict(self) -> Dict[str, Any]:
|
184
|
+
"""Convert to dictionary for JSON serialization."""
|
185
|
+
return {
|
186
|
+
"name": self.name,
|
187
|
+
"status": self.status,
|
188
|
+
"parent_name": self.parent_name,
|
189
|
+
"attributes": self.attributes,
|
190
|
+
"events": self.events,
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
class TrajectoryEvaluationTrace(BaseModel):
|
195
|
+
"""Container for a collection of trajectory evaluation spans."""
|
196
|
+
|
197
|
+
spans: List[TrajectoryEvaluationSpan]
|
198
|
+
|
199
|
+
@classmethod
|
200
|
+
def from_readable_spans(
|
201
|
+
cls, spans: List[ReadableSpan]
|
202
|
+
) -> "TrajectoryEvaluationTrace":
|
203
|
+
"""Convert a list of ReadableSpans to TrajectoryEvaluationTrace.
|
204
|
+
|
205
|
+
Args:
|
206
|
+
spans: List of OpenTelemetry ReadableSpans to convert
|
207
|
+
|
208
|
+
Returns:
|
209
|
+
TrajectoryEvaluationTrace with converted spans
|
210
|
+
"""
|
211
|
+
# Create a mapping of span IDs to names for parent lookup
|
212
|
+
span_id_to_name = {span.get_span_context().span_id: span.name for span in spans}
|
213
|
+
|
214
|
+
evaluation_spans = [
|
215
|
+
TrajectoryEvaluationSpan.from_readable_span(span, span_id_to_name)
|
216
|
+
for span in spans
|
217
|
+
]
|
218
|
+
|
219
|
+
return cls(spans=evaluation_spans)
|
220
|
+
|
221
|
+
class Config:
|
222
|
+
"""Pydantic configuration."""
|
223
|
+
|
224
|
+
arbitrary_types_allowed = True
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: uipath
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.77
|
4
4
|
Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-python
|
@@ -54,7 +54,6 @@ uipath/_cli/_evals/_models/_evaluator_base_params.py,sha256=lTYKOV66tcjW85KHTyOd
|
|
54
54
|
uipath/_cli/_evals/_models/_exceptions.py,sha256=-oXLTDa4ab9Boa34ZxuUrCezf8ajIGrIEUVwZnmBASE,195
|
55
55
|
uipath/_cli/_evals/_models/_output.py,sha256=DmwFXh1YdLiMXyXmyoZr_4hgrrv3oiHbrrtIWMqGfsg,3145
|
56
56
|
uipath/_cli/_evals/_models/_sw_reporting.py,sha256=tSBLQFAdOIun8eP0vsqt56K6bmCZz_uMaWI3hskg_24,536
|
57
|
-
uipath/_cli/_evals/_models/_trajectory_span.py,sha256=8ukM8sB9rvzBMHfC_gnexAC3xlp4uMDevKZrRzcgrm4,3637
|
58
57
|
uipath/_cli/_evals/mocks/__init__.py,sha256=2WXwAy_oZw5bKp6L0HB13QygCJeftOB_Bget0AI6Gik,32
|
59
58
|
uipath/_cli/_evals/mocks/llm_mocker.py,sha256=EtfPUhKcBRQ7vQPQdF3QanKIx2vzzYWA9PfdjKeJnTw,6108
|
60
59
|
uipath/_cli/_evals/mocks/mocker.py,sha256=FjSIqXF5HzQRi1eWrFfXBz-cYZEu5TiMVm2RsKnSEWI,626
|
@@ -137,9 +136,9 @@ uipath/eval/evaluators/deterministic_evaluator_base.py,sha256=yDWTMU1mG-93D6DscA
|
|
137
136
|
uipath/eval/evaluators/exact_match_evaluator.py,sha256=Qfz-kIUf80PKjAuge1Tc1GvN6kDB6hHveBZ86w_2How,1512
|
138
137
|
uipath/eval/evaluators/json_similarity_evaluator.py,sha256=cP4kpN-UIf690V5dq4LaCjJc2zFx-nEffUclCwDdlhM,6607
|
139
138
|
uipath/eval/evaluators/llm_as_judge_evaluator.py,sha256=l0bbn8ZLi9ZTXcgr7tJ2tsCvHFqIIeGa7sobaAHgI2Y,4927
|
140
|
-
uipath/eval/evaluators/trajectory_evaluator.py,sha256=
|
139
|
+
uipath/eval/evaluators/trajectory_evaluator.py,sha256=w9E8yUXp3KCXTfiUD-ut1OVyiOH3RpFFIIe7w3v3pBQ,5740
|
141
140
|
uipath/eval/models/__init__.py,sha256=x360CDZaRjUL3q3kh2CcXYYrQ47jwn6p6JnmhEIvMlA,419
|
142
|
-
uipath/eval/models/models.py,sha256=
|
141
|
+
uipath/eval/models/models.py,sha256=YgPnkQunjEcEiueVQnYRsbQ3Nj1yQttDQZiMCq_DDkY,6321
|
143
142
|
uipath/models/__init__.py,sha256=d_DkK1AtRUetM1t2NrH5UKgvJOBiynzaKnK5pMY7aIc,1289
|
144
143
|
uipath/models/action_schema.py,sha256=tBn1qQ3NQLU5nwWlBIzIKIx3XK5pO_D1S51IjFlZ1FA,610
|
145
144
|
uipath/models/actions.py,sha256=1vRsJ3JSmMdPkbiYAiHzY8K44vmW3VlMsmQUBAkSgrQ,3141
|
@@ -167,8 +166,8 @@ uipath/tracing/_traced.py,sha256=yBIY05PCCrYyx50EIHZnwJaKNdHPNx-YTR1sHQl0a98,199
|
|
167
166
|
uipath/tracing/_utils.py,sha256=qd7N56tg6VXQ9pREh61esBgUWLNA0ssKsE0QlwrRWFM,11974
|
168
167
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
169
168
|
uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
|
170
|
-
uipath-2.1.
|
171
|
-
uipath-2.1.
|
172
|
-
uipath-2.1.
|
173
|
-
uipath-2.1.
|
174
|
-
uipath-2.1.
|
169
|
+
uipath-2.1.77.dist-info/METADATA,sha256=oiBQqPLJtyrZHTtr_KWQLgnE2nQ3ZDT7aotqSCmssgU,6593
|
170
|
+
uipath-2.1.77.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
171
|
+
uipath-2.1.77.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
172
|
+
uipath-2.1.77.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
173
|
+
uipath-2.1.77.dist-info/RECORD,,
|
@@ -1,115 +0,0 @@
|
|
1
|
-
"""Trajectory evaluation span model for serializing span data in evaluations."""
|
2
|
-
|
3
|
-
from dataclasses import dataclass
|
4
|
-
from typing import Any, Dict, List, Optional
|
5
|
-
|
6
|
-
from opentelemetry.sdk.trace import ReadableSpan
|
7
|
-
from pydantic import BaseModel
|
8
|
-
|
9
|
-
|
10
|
-
@dataclass
|
11
|
-
class TrajectoryEvaluationSpan:
|
12
|
-
"""Simplified span representation for trajectory evaluation.
|
13
|
-
|
14
|
-
Contains span information needed for evaluating agent execution paths,
|
15
|
-
excluding timestamps which are not useful for trajectory analysis.
|
16
|
-
"""
|
17
|
-
|
18
|
-
name: str
|
19
|
-
status: str
|
20
|
-
attributes: Dict[str, Any]
|
21
|
-
parent_name: Optional[str] = None
|
22
|
-
events: Optional[List[Dict[str, Any]]] = None
|
23
|
-
|
24
|
-
def __post_init__(self):
|
25
|
-
"""Initialize default values."""
|
26
|
-
if self.events is None:
|
27
|
-
self.events = []
|
28
|
-
|
29
|
-
@classmethod
|
30
|
-
def from_readable_span(
|
31
|
-
cls, span: ReadableSpan, parent_spans: Optional[Dict[int, str]] = None
|
32
|
-
) -> "TrajectoryEvaluationSpan":
|
33
|
-
"""Convert a ReadableSpan to a TrajectoryEvaluationSpan.
|
34
|
-
|
35
|
-
Args:
|
36
|
-
span: The OpenTelemetry ReadableSpan to convert
|
37
|
-
parent_spans: Optional mapping of span IDs to names for parent lookup
|
38
|
-
|
39
|
-
Returns:
|
40
|
-
TrajectoryEvaluationSpan with relevant data extracted
|
41
|
-
"""
|
42
|
-
# Extract status
|
43
|
-
status_map = {0: "unset", 1: "ok", 2: "error"}
|
44
|
-
status = status_map.get(span.status.status_code.value, "unknown")
|
45
|
-
|
46
|
-
# Extract attributes - keep all attributes for now
|
47
|
-
attributes = {}
|
48
|
-
if span.attributes:
|
49
|
-
attributes = dict(span.attributes)
|
50
|
-
|
51
|
-
# Get parent name if available
|
52
|
-
parent_name = None
|
53
|
-
if span.parent and parent_spans and span.parent.span_id in parent_spans:
|
54
|
-
parent_name = parent_spans[span.parent.span_id]
|
55
|
-
|
56
|
-
# Extract events (without timestamps)
|
57
|
-
events = []
|
58
|
-
if hasattr(span, "events") and span.events:
|
59
|
-
for event in span.events:
|
60
|
-
event_data = {
|
61
|
-
"name": event.name,
|
62
|
-
"attributes": dict(event.attributes) if event.attributes else {},
|
63
|
-
}
|
64
|
-
events.append(event_data)
|
65
|
-
|
66
|
-
return cls(
|
67
|
-
name=span.name,
|
68
|
-
status=status,
|
69
|
-
attributes=attributes,
|
70
|
-
parent_name=parent_name,
|
71
|
-
events=events,
|
72
|
-
)
|
73
|
-
|
74
|
-
def to_dict(self) -> Dict[str, Any]:
|
75
|
-
"""Convert to dictionary for JSON serialization."""
|
76
|
-
return {
|
77
|
-
"name": self.name,
|
78
|
-
"status": self.status,
|
79
|
-
"parent_name": self.parent_name,
|
80
|
-
"attributes": self.attributes,
|
81
|
-
"events": self.events,
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
class TrajectoryEvaluationTrace(BaseModel):
|
86
|
-
"""Container for a collection of trajectory evaluation spans."""
|
87
|
-
|
88
|
-
spans: List[TrajectoryEvaluationSpan]
|
89
|
-
|
90
|
-
@classmethod
|
91
|
-
def from_readable_spans(
|
92
|
-
cls, spans: List[ReadableSpan]
|
93
|
-
) -> "TrajectoryEvaluationTrace":
|
94
|
-
"""Convert a list of ReadableSpans to TrajectoryEvaluationTrace.
|
95
|
-
|
96
|
-
Args:
|
97
|
-
spans: List of OpenTelemetry ReadableSpans to convert
|
98
|
-
|
99
|
-
Returns:
|
100
|
-
TrajectoryEvaluationTrace with converted spans
|
101
|
-
"""
|
102
|
-
# Create a mapping of span IDs to names for parent lookup
|
103
|
-
span_id_to_name = {span.get_span_context().span_id: span.name for span in spans}
|
104
|
-
|
105
|
-
evaluation_spans = [
|
106
|
-
TrajectoryEvaluationSpan.from_readable_span(span, span_id_to_name)
|
107
|
-
for span in spans
|
108
|
-
]
|
109
|
-
|
110
|
-
return cls(spans=evaluation_spans)
|
111
|
-
|
112
|
-
class Config:
|
113
|
-
"""Pydantic configuration."""
|
114
|
-
|
115
|
-
arbitrary_types_allowed = True
|
File without changes
|
File without changes
|
File without changes
|