aid-runtime-python 0.1.121__py3-none-any.whl → 0.1.123__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.
- aid_runtime/__init__.py +1 -1
- aid_runtime/agents/guardrails.py +22 -5
- aid_runtime/agents/ir.py +6 -0
- {aid_runtime_python-0.1.121.dist-info → aid_runtime_python-0.1.123.dist-info}/METADATA +1 -1
- {aid_runtime_python-0.1.121.dist-info → aid_runtime_python-0.1.123.dist-info}/RECORD +7 -7
- {aid_runtime_python-0.1.121.dist-info → aid_runtime_python-0.1.123.dist-info}/WHEEL +0 -0
- {aid_runtime_python-0.1.121.dist-info → aid_runtime_python-0.1.123.dist-info}/top_level.txt +0 -0
aid_runtime/__init__.py
CHANGED
aid_runtime/agents/guardrails.py
CHANGED
|
@@ -460,10 +460,15 @@ class GuardrailEngine:
|
|
|
460
460
|
) -> GuardrailRecord | None:
|
|
461
461
|
"""Ask one ``choice`` decision and turn its label into a record, or ``None``.
|
|
462
462
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
--
|
|
463
|
+
An undeclared decision, an unmapped label, an unknown outcome, or a confidence
|
|
464
|
+
below the declared floor is a :class:`GuardrailBlockedError`: an answer the
|
|
465
|
+
guardrail can read but cannot act on blocks. A call that produced no label at
|
|
466
|
+
all -- it raised, named no answer, or carried no choice -- follows the
|
|
467
|
+
decision's ``on_error`` instead: ``allow`` returns ``None`` so an advisory check
|
|
468
|
+
does not stop traffic, and ``block`` (the default) raises. ``on_error`` governs
|
|
469
|
+
whether the answer arrived, never what a present answer means, so the policy
|
|
470
|
+
path's rule holds: there is no path from "the check could not run" to "no
|
|
471
|
+
violation found" unless the spec declares one.
|
|
467
472
|
"""
|
|
468
473
|
name = guardrail.decision or ""
|
|
469
474
|
definition = self._decisions.get(name)
|
|
@@ -494,6 +499,8 @@ class GuardrailEngine:
|
|
|
494
499
|
questions={name: question},
|
|
495
500
|
)
|
|
496
501
|
except Exception as error:
|
|
502
|
+
if definition.on_error == "allow":
|
|
503
|
+
return None
|
|
497
504
|
raise GuardrailBlockedError(
|
|
498
505
|
guardrail.id,
|
|
499
506
|
"input",
|
|
@@ -502,13 +509,23 @@ class GuardrailEngine:
|
|
|
502
509
|
|
|
503
510
|
answer = response.answers.get(name)
|
|
504
511
|
if answer is None:
|
|
512
|
+
if definition.on_error == "allow":
|
|
513
|
+
return None
|
|
505
514
|
raise GuardrailBlockedError(
|
|
506
515
|
guardrail.id,
|
|
507
516
|
"input",
|
|
508
517
|
f"decision {name!r} returned no answer for its own question",
|
|
509
518
|
)
|
|
510
519
|
label = answer.choice
|
|
511
|
-
if label is None
|
|
520
|
+
if label is None:
|
|
521
|
+
if definition.on_error == "allow":
|
|
522
|
+
return None
|
|
523
|
+
raise GuardrailBlockedError(
|
|
524
|
+
guardrail.id,
|
|
525
|
+
"input",
|
|
526
|
+
f"decision {name!r} returned an answer with no choice",
|
|
527
|
+
)
|
|
528
|
+
if label not in outcomes:
|
|
512
529
|
raise GuardrailBlockedError(
|
|
513
530
|
guardrail.id,
|
|
514
531
|
"input",
|
aid_runtime/agents/ir.py
CHANGED
|
@@ -122,6 +122,11 @@ class DecisionDefinition:
|
|
|
122
122
|
model: str
|
|
123
123
|
instructions: str
|
|
124
124
|
criteria: tuple[str, ...]
|
|
125
|
+
#: What a call that could not answer means: ``allow`` lets the payload through,
|
|
126
|
+
#: ``block`` (the declared default) fails the check closed. It never governs an
|
|
127
|
+
#: answer the guardrail can read but not act on -- an unmapped label or a
|
|
128
|
+
#: confidence under the floor is a policy failure and blocks regardless.
|
|
129
|
+
on_error: str = "block"
|
|
125
130
|
|
|
126
131
|
|
|
127
132
|
@dataclass(frozen=True, slots=True)
|
|
@@ -443,6 +448,7 @@ def _decision(decision_id: str, entry: Mapping[str, Any]) -> DecisionDefinition:
|
|
|
443
448
|
model=_required_str(entry, "model", where),
|
|
444
449
|
instructions=_required_str(entry, "instructions", where),
|
|
445
450
|
criteria=labels,
|
|
451
|
+
on_error="allow" if entry.get("onError") == "allow" else "block",
|
|
446
452
|
)
|
|
447
453
|
|
|
448
454
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aid-runtime-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.123
|
|
4
4
|
Summary: The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline.
|
|
5
5
|
Author: The AID Framework authors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
aid_runtime/__init__.py,sha256=
|
|
1
|
+
aid_runtime/__init__.py,sha256=SAeSFGl9d5de2XUB7IwLVZG8U2GIDa44TADgP08PpTU,13238
|
|
2
2
|
aid_runtime/cache.py,sha256=jhw_EBd9dfWEUzYeibOvIkVBqqiLUjqF5WKEPz9GkhE,6836
|
|
3
3
|
aid_runtime/concurrency.py,sha256=z0tFQHw35ttFLKfazGBjCMPOLQOnUotE_OPpvR1piH4,2829
|
|
4
4
|
aid_runtime/control.py,sha256=y6wPn0fqYJv0nVSsjzpzfiaq1Y7zBoMxCpdrEuqkfvg,17529
|
|
@@ -19,8 +19,8 @@ aid_runtime/agents/__init__.py,sha256=H_WKu9u0fvF56W7ccTByEv1RdayzwUfRzEKsXXDRr2
|
|
|
19
19
|
aid_runtime/agents/chat_model.py,sha256=fZdCmSpoECuBVGZE1s8NmT2erT33RhDuLh3yJM6kAJE,14808
|
|
20
20
|
aid_runtime/agents/deep_agents.py,sha256=Eg_BLm2cg7T_tXSxR7ag8SEvTMCFBLHoIvln3BoWORw,26966
|
|
21
21
|
aid_runtime/agents/engine.py,sha256=3cXCYY806URDblYD500cfw7873IoVCy8BH1d4h2YAsc,5789
|
|
22
|
-
aid_runtime/agents/guardrails.py,sha256=
|
|
23
|
-
aid_runtime/agents/ir.py,sha256=
|
|
22
|
+
aid_runtime/agents/guardrails.py,sha256=0HhbToZBxPZHEDRLyD9BGS_jmV-TkKPGEhRynYxLXx8,32813
|
|
23
|
+
aid_runtime/agents/ir.py,sha256=MgqX5gEkq7vimXojtSNb5MuVeTIZaWkZCFitxAqSAe0,32855
|
|
24
24
|
aid_runtime/agents/loop.py,sha256=iQ_kk-Miu7oZUKeRtCpMGzAQUwV2IaVM9BdXhThZ77I,52728
|
|
25
25
|
aid_runtime/agents/managed.py,sha256=SFyx6Rca2aoiMzA9q6B4Nfes6ZCjn_5_zN0SxzemIII,23247
|
|
26
26
|
aid_runtime/agents/memory.py,sha256=6_D6k2bzAiR2euNvzr6HB28wsUUq-R-WTQc12gkB8ao,9156
|
|
@@ -55,7 +55,7 @@ aid_runtime/retrieval/rerank.py,sha256=L4ICBi9YHDzhnKVtImKh5Wzre1HDzS8at-AKDkXBJ
|
|
|
55
55
|
aid_runtime/retrieval/retriever.py,sha256=5I8BocFaJ292cqh9-Gz2NRB4OwBHa-pitAB6--5ARBE,19890
|
|
56
56
|
aid_runtime/retrieval/stores.py,sha256=VEi68AaMHcQjdAbWOHflp3jCl1_1db71rIzZjTouLlo,5857
|
|
57
57
|
aid_runtime/retrieval/types.py,sha256=bke4W2q8ecGFvF2tj8y1tfFq8EtGb6iiPVbT-l02a98,19860
|
|
58
|
-
aid_runtime_python-0.1.
|
|
59
|
-
aid_runtime_python-0.1.
|
|
60
|
-
aid_runtime_python-0.1.
|
|
61
|
-
aid_runtime_python-0.1.
|
|
58
|
+
aid_runtime_python-0.1.123.dist-info/METADATA,sha256=dgMj5tivYk4-q4IhcKgt7MfeDDcxQlYd5pW3eUtdU80,17006
|
|
59
|
+
aid_runtime_python-0.1.123.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
60
|
+
aid_runtime_python-0.1.123.dist-info/top_level.txt,sha256=QvODgNVRDDMmLcTnoIQ4jYnhqf-N4b9sHWEmaUUxp44,12
|
|
61
|
+
aid_runtime_python-0.1.123.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|