uipath-core 0.3.0__py3-none-any.whl → 0.3.1__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/core/guardrails/guardrails.py +34 -2
- {uipath_core-0.3.0.dist-info → uipath_core-0.3.1.dist-info}/METADATA +1 -1
- {uipath_core-0.3.0.dist-info → uipath_core-0.3.1.dist-info}/RECORD +5 -5
- {uipath_core-0.3.0.dist-info → uipath_core-0.3.1.dist-info}/WHEEL +0 -0
- {uipath_core-0.3.0.dist-info → uipath_core-0.3.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"""Guardrails models for UiPath Platform."""
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Annotated, Callable, Literal
|
|
4
|
+
from typing import Annotated, Any, Callable, Literal
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _decapitalize_first_letter(s: str) -> str:
|
|
10
|
+
"""Convert first letter to lowercase (e.g., 'SimpleText' -> 'simpleText')."""
|
|
11
|
+
if not s or len(s) == 0:
|
|
12
|
+
return s
|
|
13
|
+
if len(s) == 1:
|
|
14
|
+
return s.lower()
|
|
15
|
+
return s[0].lower() + s[1:]
|
|
7
16
|
|
|
8
17
|
|
|
9
18
|
class GuardrailValidationResultType(str, Enum):
|
|
@@ -56,6 +65,12 @@ class FieldReference(BaseModel):
|
|
|
56
65
|
|
|
57
66
|
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
58
67
|
|
|
68
|
+
@field_validator("source", mode="before")
|
|
69
|
+
@classmethod
|
|
70
|
+
def normalize_type(cls, v: Any) -> Any:
|
|
71
|
+
"""Normalize type by decapitalizing first letter."""
|
|
72
|
+
return _decapitalize_first_letter(v) if isinstance(v, str) else v
|
|
73
|
+
|
|
59
74
|
|
|
60
75
|
class SelectorType(str, Enum):
|
|
61
76
|
"""Selector type enumeration."""
|
|
@@ -72,6 +87,17 @@ class AllFieldsSelector(BaseModel):
|
|
|
72
87
|
|
|
73
88
|
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
74
89
|
|
|
90
|
+
@field_validator("sources", mode="before")
|
|
91
|
+
@classmethod
|
|
92
|
+
def normalize_sources(cls, v: Any) -> Any:
|
|
93
|
+
"""Normalize sources by decapitalizing first letter of each item."""
|
|
94
|
+
if isinstance(v, list):
|
|
95
|
+
return [
|
|
96
|
+
_decapitalize_first_letter(item) if isinstance(item, str) else item
|
|
97
|
+
for item in v
|
|
98
|
+
]
|
|
99
|
+
return v
|
|
100
|
+
|
|
75
101
|
|
|
76
102
|
class SpecificFieldsSelector(BaseModel):
|
|
77
103
|
"""Specific fields selector."""
|
|
@@ -128,6 +154,12 @@ class UniversalRule(BaseModel):
|
|
|
128
154
|
|
|
129
155
|
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
130
156
|
|
|
157
|
+
@field_validator("apply_to", mode="before")
|
|
158
|
+
@classmethod
|
|
159
|
+
def normalize_type(cls, v: Any) -> Any:
|
|
160
|
+
"""Normalize type by decapitalizing first letter."""
|
|
161
|
+
return _decapitalize_first_letter(v) if isinstance(v, str) else v
|
|
162
|
+
|
|
131
163
|
|
|
132
164
|
class NumberRule(BaseModel):
|
|
133
165
|
"""Number rule model."""
|
|
@@ -17,7 +17,7 @@ uipath/core/errors/errors.py,sha256=5LajjuTfNW82ju07wT5mD3tXk0S-Ju7OqJqQpPN0F6g,
|
|
|
17
17
|
uipath/core/guardrails/__init__.py,sha256=hUCmD4y5te2iy01YnJlBuf2RWvqxmsNzoyOamXLXf2E,1028
|
|
18
18
|
uipath/core/guardrails/_deterministic_guardrails_service.py,sha256=61ROXYmX3rjBfFUp7E83fm4Lk7h1DlJeukpZm7uzVqQ,6355
|
|
19
19
|
uipath/core/guardrails/_evaluators.py,sha256=10tIRUufxoy9MkZPb-ytjsCSCIfIqQSOYXyEl4G7PSw,15649
|
|
20
|
-
uipath/core/guardrails/guardrails.py,sha256=
|
|
20
|
+
uipath/core/guardrails/guardrails.py,sha256=MPWNaXPzfEgPC_tnBE83G9ggH1JcJYtvp_BNorVNF0Y,6746
|
|
21
21
|
uipath/core/serialization/__init__.py,sha256=thAMx0WY03vnqhKCDVc9burqKWDxSNn3R-CJQU_1LIs,186
|
|
22
22
|
uipath/core/serialization/json.py,sha256=S0-ykGfroleRC0gJBNuTyJCx-GB8e6ZG9uTUKiD4PSc,4791
|
|
23
23
|
uipath/core/tracing/__init__.py,sha256=Y0wfRSGCVcDoFYTmTkVQElu5JE91h4dTNkKQnd86dBM,568
|
|
@@ -28,7 +28,7 @@ uipath/core/tracing/processors.py,sha256=XlMKA_AWwrtC-0ytnAHxl4P9kXlQdsjcn8zwnSp
|
|
|
28
28
|
uipath/core/tracing/span_utils.py,sha256=LZXNdnI0-fhKe49CLPsvMJIfh9zdzk8rK4g4YN5RfDU,13064
|
|
29
29
|
uipath/core/tracing/trace_manager.py,sha256=vmPup-C2pSgwpSdcCzAjzP_nTtRWZgqlxnNT50ygOfk,3843
|
|
30
30
|
uipath/core/tracing/types.py,sha256=8A8fFuWqMGk0SzIrFbMajmY6LA3w57h-YA602OctCrI,634
|
|
31
|
-
uipath_core-0.3.
|
|
32
|
-
uipath_core-0.3.
|
|
33
|
-
uipath_core-0.3.
|
|
34
|
-
uipath_core-0.3.
|
|
31
|
+
uipath_core-0.3.1.dist-info/METADATA,sha256=CSr0nrG76r9b5cXKRH2bGsnZV0t2cosAcOp0TLxYvtc,938
|
|
32
|
+
uipath_core-0.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
33
|
+
uipath_core-0.3.1.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
34
|
+
uipath_core-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|