uipath-core 0.1.5__py3-none-any.whl → 0.1.6__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/__init__.py +2 -0
- uipath/core/guardrails/_deterministic_guardrails_service.py +8 -5
- uipath/core/guardrails/_evaluators.py +6 -6
- uipath/core/guardrails/guardrails.py +12 -3
- {uipath_core-0.1.5.dist-info → uipath_core-0.1.6.dist-info}/METADATA +1 -1
- {uipath_core-0.1.5.dist-info → uipath_core-0.1.6.dist-info}/RECORD +8 -8
- {uipath_core-0.1.5.dist-info → uipath_core-0.1.6.dist-info}/WHEEL +0 -0
- {uipath_core-0.1.5.dist-info → uipath_core-0.1.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,6 +16,7 @@ from .guardrails import (
|
|
|
16
16
|
GuardrailScope,
|
|
17
17
|
GuardrailSelector,
|
|
18
18
|
GuardrailValidationResult,
|
|
19
|
+
GuardrailValidationResultType,
|
|
19
20
|
NumberRule,
|
|
20
21
|
Rule,
|
|
21
22
|
SelectorType,
|
|
@@ -43,4 +44,5 @@ __all__ = [
|
|
|
43
44
|
"GuardrailScope",
|
|
44
45
|
"GuardrailSelector",
|
|
45
46
|
"GuardrailValidationResult",
|
|
47
|
+
"GuardrailValidationResultType",
|
|
46
48
|
]
|
|
@@ -16,6 +16,7 @@ from .guardrails import (
|
|
|
16
16
|
DeterministicGuardrail,
|
|
17
17
|
FieldSource,
|
|
18
18
|
GuardrailValidationResult,
|
|
19
|
+
GuardrailValidationResultType,
|
|
19
20
|
NumberRule,
|
|
20
21
|
SpecificFieldsSelector,
|
|
21
22
|
UniversalRule,
|
|
@@ -38,7 +39,7 @@ class DeterministicGuardrailsService(BaseModel):
|
|
|
38
39
|
# Output rules will be evaluated during post-execution
|
|
39
40
|
if has_output_rule:
|
|
40
41
|
return GuardrailValidationResult(
|
|
41
|
-
|
|
42
|
+
result=GuardrailValidationResultType.PASSED,
|
|
42
43
|
reason="Guardrail contains output-dependent rules that will be evaluated during post-execution",
|
|
43
44
|
)
|
|
44
45
|
return self._evaluate_deterministic_guardrail(
|
|
@@ -64,7 +65,7 @@ class DeterministicGuardrailsService(BaseModel):
|
|
|
64
65
|
# Only input rules exist and they should have been evaluated during pre-execution
|
|
65
66
|
if not has_output_rule:
|
|
66
67
|
return GuardrailValidationResult(
|
|
67
|
-
|
|
68
|
+
result=GuardrailValidationResultType.PASSED,
|
|
68
69
|
reason="Guardrail contains only input-dependent rules that were evaluated during pre-execution",
|
|
69
70
|
)
|
|
70
71
|
|
|
@@ -128,15 +129,17 @@ class DeterministicGuardrailsService(BaseModel):
|
|
|
128
129
|
passed, reason = evaluate_universal_rule(rule, output_data)
|
|
129
130
|
else:
|
|
130
131
|
return GuardrailValidationResult(
|
|
131
|
-
|
|
132
|
+
result=GuardrailValidationResultType.VALIDATION_FAILED,
|
|
132
133
|
reason=f"Unknown rule type: {type(rule)}",
|
|
133
134
|
)
|
|
134
135
|
|
|
135
136
|
if not passed:
|
|
136
137
|
return GuardrailValidationResult(
|
|
137
|
-
|
|
138
|
+
result=GuardrailValidationResultType.VALIDATION_FAILED,
|
|
139
|
+
reason=reason or "Rule validation failed",
|
|
138
140
|
)
|
|
139
141
|
|
|
140
142
|
return GuardrailValidationResult(
|
|
141
|
-
|
|
143
|
+
result=GuardrailValidationResultType.PASSED,
|
|
144
|
+
reason="All deterministic guardrail rules passed",
|
|
142
145
|
)
|
|
@@ -288,13 +288,13 @@ def evaluate_universal_rule(
|
|
|
288
288
|
|
|
289
289
|
Universal rules trigger based on the apply_to scope and execution phase:
|
|
290
290
|
- Pre-execution (empty output_data):
|
|
291
|
-
- INPUT: triggers (
|
|
292
|
-
- OUTPUT: does not trigger (
|
|
293
|
-
- INPUT_AND_OUTPUT: triggers (
|
|
291
|
+
- INPUT: triggers (result = VALIDATION_FAILED)
|
|
292
|
+
- OUTPUT: does not trigger (result = PASSED)
|
|
293
|
+
- INPUT_AND_OUTPUT: triggers (result = VALIDATION_FAILED)
|
|
294
294
|
- Post-execution (output_data has data):
|
|
295
|
-
- INPUT: does not trigger (
|
|
296
|
-
- OUTPUT: triggers (
|
|
297
|
-
- INPUT_AND_OUTPUT: triggers (
|
|
295
|
+
- INPUT: does not trigger (result = PASSED)
|
|
296
|
+
- OUTPUT: triggers (result = VALIDATION_FAILED)
|
|
297
|
+
- INPUT_AND_OUTPUT: triggers (result = VALIDATION_FAILED)
|
|
298
298
|
"""
|
|
299
299
|
# Determine if this is pre-execution (no output data) or post-execution
|
|
300
300
|
is_pre_execution = not output_data or len(output_data) == 0
|
|
@@ -6,18 +6,27 @@ from typing import Annotated, Callable, Literal
|
|
|
6
6
|
from pydantic import BaseModel, ConfigDict, Field
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
class GuardrailValidationResultType(str, Enum):
|
|
10
|
+
"""Guardrail validation result type enumeration."""
|
|
11
|
+
|
|
12
|
+
PASSED = "passed"
|
|
13
|
+
VALIDATION_FAILED = "validation_failed"
|
|
14
|
+
ENTITLEMENTS_MISSING = "entitlements_missing"
|
|
15
|
+
FEATURE_DISABLED = "feature_disabled"
|
|
16
|
+
|
|
17
|
+
|
|
9
18
|
class GuardrailValidationResult(BaseModel):
|
|
10
19
|
"""Result returned from validating input with a given guardrail.
|
|
11
20
|
|
|
12
21
|
Attributes:
|
|
13
|
-
|
|
22
|
+
result: The validation result type.
|
|
14
23
|
reason: Textual explanation describing why the validation passed or failed.
|
|
15
24
|
"""
|
|
16
25
|
|
|
17
26
|
model_config = ConfigDict(populate_by_name=True)
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
alias="
|
|
28
|
+
result: GuardrailValidationResultType = Field(
|
|
29
|
+
alias="result", description="Validation result."
|
|
21
30
|
)
|
|
22
31
|
reason: str = Field(
|
|
23
32
|
alias="reason", description="Explanation for the validation result."
|
|
@@ -14,10 +14,10 @@ uipath/core/chat/meta.py,sha256=3t0eS9UHoAPHre97QTUeVbjDhnMX4zj4-qG6ju0B8wY,315
|
|
|
14
14
|
uipath/core/chat/tool.py,sha256=6e5pyX3hOWM5fIzr_fdG49Mbzz6XzJD3nsmha-yGa2k,2308
|
|
15
15
|
uipath/core/errors/__init__.py,sha256=gjxdLibZ0fjwgzPuLJY04P8dIX9rbSM2wQ97jP34ucE,278
|
|
16
16
|
uipath/core/errors/errors.py,sha256=5LajjuTfNW82ju07wT5mD3tXk0S-Ju7OqJqQpPN0F6g,486
|
|
17
|
-
uipath/core/guardrails/__init__.py,sha256=
|
|
18
|
-
uipath/core/guardrails/_deterministic_guardrails_service.py,sha256=
|
|
19
|
-
uipath/core/guardrails/_evaluators.py,sha256=
|
|
20
|
-
uipath/core/guardrails/guardrails.py,sha256=
|
|
17
|
+
uipath/core/guardrails/__init__.py,sha256=hUCmD4y5te2iy01YnJlBuf2RWvqxmsNzoyOamXLXf2E,1028
|
|
18
|
+
uipath/core/guardrails/_deterministic_guardrails_service.py,sha256=uX8f2HSGZ1bf5QFM9fnz0CvglxI3UIqY4OhHrKzemaU,5967
|
|
19
|
+
uipath/core/guardrails/_evaluators.py,sha256=ovmVm-8iB8Pm9arjG7mHM9-GIRkrG3V6oHRPHKxZVO0,14601
|
|
20
|
+
uipath/core/guardrails/guardrails.py,sha256=DraeFkoDKVDnc0EKdFYYP29lQu7U2hneTsj1dxveHU4,4935
|
|
21
21
|
uipath/core/tracing/__init__.py,sha256=1XNLYZ4J76XkRrizGO486mS6yxzVXUbrldpvxTyJe3E,483
|
|
22
22
|
uipath/core/tracing/_utils.py,sha256=FiCFGOFa4czruhlSF87Q5Q4jX9KKPHZiw8k14K7W5v4,6636
|
|
23
23
|
uipath/core/tracing/decorators.py,sha256=ag_MFwZ0TywrhbpLKqQwF1guvRA9sYiItxao5LN9_Iw,10942
|
|
@@ -25,7 +25,7 @@ uipath/core/tracing/exporters.py,sha256=FClouEEQfk3F8J7G_NFoarDJM3R0-gA5jUxA5xRH
|
|
|
25
25
|
uipath/core/tracing/processors.py,sha256=R_652rtjPmfpUtaXoIcmfZrRZylVXFRNwjOmJUUxOQw,1408
|
|
26
26
|
uipath/core/tracing/span_utils.py,sha256=WYBrd6ZbawAs7r1Js-Zvo9_8GzkD9LhHNOls00bK_xI,12235
|
|
27
27
|
uipath/core/tracing/trace_manager.py,sha256=51rscJcepkTK4bWoCZdE-DFc9wt2F-aSuFBaSXmkHl0,3130
|
|
28
|
-
uipath_core-0.1.
|
|
29
|
-
uipath_core-0.1.
|
|
30
|
-
uipath_core-0.1.
|
|
31
|
-
uipath_core-0.1.
|
|
28
|
+
uipath_core-0.1.6.dist-info/METADATA,sha256=R2wS5I85yHd-uTvGgepwbhKiZA7cLb389XJ5R57ED7I,938
|
|
29
|
+
uipath_core-0.1.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
30
|
+
uipath_core-0.1.6.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
31
|
+
uipath_core-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|