jamjet-guardrails-validators 0.1.0__tar.gz

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.
@@ -0,0 +1,30 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ dist/
4
+ build/
5
+ .venv/
6
+ .pytest_cache/
7
+ # Hypothesis writes its own caches here. The `ci` profile in tests/conftest.py
8
+ # sets `database=None`, so no failing example is stored, but the unicode and
9
+ # constants caches are written regardless.
10
+ .hypothesis/
11
+ .ruff_cache/
12
+ .mypy_cache/
13
+ .claude/
14
+ .superpowers/
15
+ docs/superpowers/
16
+ CLAUDE.md
17
+ progress-tracker.md
18
+ REQUIREMENTS.md
19
+ docs/specs/
20
+ benchmarks/.cache/
21
+
22
+ # The training tree's virtualenv, which is NOT the package's `.venv`. The rule
23
+ # above matches a directory named exactly `.venv` and does not reach this one.
24
+ /.venv-training/
25
+
26
+ # Raw downloads and intermediate splits for the training tree. Anchored with a
27
+ # leading slash on purpose: a bare `data/` also matches any nested directory of
28
+ # that name, and `data` is common enough that an unanchored rule would silently
29
+ # swallow a real source directory somewhere under src/ or corpora/.
30
+ /data/
@@ -0,0 +1,204 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+ Copyright 2026 JamJet Labs
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.5
2
+ Name: jamjet-guardrails-validators
3
+ Version: 0.1.0
4
+ Summary: Guardrails AI validators backed by jamjet-guardrails.
5
+ Project-URL: Homepage, https://github.com/jamjet-labs/jamjet-guardrails
6
+ Project-URL: Repository, https://github.com/jamjet-labs/jamjet-guardrails
7
+ Project-URL: Issues, https://github.com/jamjet-labs/jamjet-guardrails/issues
8
+ Author: Sunil Prakash
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: guardrails,guardrails-ai,llm-security,pii,prompt-injection,validator
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Security
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: <3.14,>=3.10
22
+ Requires-Dist: guardrails-ai<1.0.0,>=0.11.0
23
+ Requires-Dist: jamjet-guardrails<1.0.0,>=0.3.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.11; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: ruff>=0.6; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # jamjet-guardrails-validators
31
+
32
+ [Guardrails AI](https://github.com/guardrails-ai/guardrails) validators backed by
33
+ [jamjet-guardrails](https://github.com/jamjet-labs/jamjet-guardrails), a
34
+ zero-dependency library of deterministic content checks with published precision
35
+ and recall.
36
+
37
+ Installed from PyPI, not from the Guardrails Hub, which is closed. Every
38
+ validator here is an ordinary pip install.
39
+
40
+ ## Install
41
+
42
+ ```
43
+ pip install jamjet-guardrails-validators
44
+ ```
45
+
46
+ Requires Python 3.10 to 3.13, the range `guardrails-ai` itself supports.
47
+
48
+ ## Use the composite
49
+
50
+ ```python
51
+ from guardrails import Guard
52
+ from jamjet_guardrails_validators import JamJetChain
53
+
54
+ guard = Guard().use(JamJetChain(checks=["pii", "secrets"], on_fail="fix"))
55
+
56
+ outcome = guard.validate("SLACK_BOT_TOKEN=xoxb-0000000000-2000000000008-EXAMPLEONLYnotarealtoken")
57
+ outcome.validated_output
58
+ # 'SLACK_BOT_TOKEN=[REDACTED:CREDIT_CARD+SLACK_TOKEN]'
59
+ ```
60
+
61
+ ## Why one validator and not two
62
+
63
+ Stacking `jamjet/pii` and `jamjet/secrets` as two validators is not the same
64
+ thing, and the difference is a leak rather than a preference. Measured on
65
+ guardrails-ai 0.11.0, which has two validator services and picks between them
66
+ without asking.
67
+
68
+ **The sequential service** (`GUARDRAILS_RUN_SYNC=true`) hands each validator the
69
+ previous validator's `fix_value`. Over the token above, with `jamjet/pii` first,
70
+ the guard reports `validation_passed=True` and returns:
71
+
72
+ ```
73
+ SLACK_BOT_TOKEN=[REDACTED:SLACK_TOKEN][REDACTED:CREDIT_CARD]-EXAMPLEONLYnotarealtoken
74
+ ```
75
+
76
+ The 13-digit middle segment is Luhn-valid and begins with a 2, so the PII check
77
+ reads it as a payment card and redacts it first. That placeholder splits the
78
+ token in half. The secrets check then matches only the 16-character prefix, and
79
+ the 24-character secret tail survives into a value the guard calls valid.
80
+
81
+ **The default async service** runs every validator over the original value and
82
+ combines the fixes with a three-way merge. That closes the stump above and opens
83
+ something worse: a `FailResult` with no `fix_value`, which is what a deny is, is
84
+ outvoted by one that carries a fix. Stacking `jamjet/injection-structural` with
85
+ `jamjet/pii` under `on_fail="fix"`, over a string carrying both an address and a
86
+ tag-character injection payload, returns `validation_passed=False` in one order
87
+ and `validation_passed=True` with the payload intact in the other.
88
+
89
+ `JamJetChain` has neither failure because it does not compose fixes at all. It
90
+ runs one chain, which hands every check the same original string, merges every
91
+ redaction in a single pass over that string, and combines decisions restrictively
92
+ so a later check cannot talk an earlier deny back down to a pass. The host gets
93
+ one `FailResult` with one `fix_value`, and the placeholder names every check that
94
+ claimed the region: `[REDACTED:CREDIT_CARD+SLACK_TOKEN]` rather than one of the
95
+ two.
96
+
97
+ The per-check validators exist for a caller composing a single check. If you want
98
+ two, use the composite.
99
+
100
+ ## Which checks you can name
101
+
102
+ `checks` takes any check the installed `jamjet-guardrails` registers. That list
103
+ grows with the core library, so read it from the library rather than from this
104
+ page:
105
+
106
+ ```python
107
+ from jamjet_guardrails_validators import VALIDATORS
108
+ sorted(VALIDATORS)
109
+ ```
110
+
111
+ `VALIDATORS` is generated from `jamjet_guardrails.detectors.AVAILABLE` at import,
112
+ so a check added to the core is a validator here with no edit. A single check:
113
+
114
+ ```python
115
+ from jamjet_guardrails_validators import validator_for
116
+
117
+ guard = Guard().use(validator_for("pii")(on_fail="fix"))
118
+ ```
119
+
120
+ A check that takes options is configured through `options`, keyed by check name:
121
+
122
+ ```python
123
+ JamJetChain(checks=["secrets"], options={"secrets": {"on_match": "deny"}}, on_fail="exception")
124
+ ```
125
+
126
+ ## Choosing `on_fail`
127
+
128
+ | Chain decision | `FailResult` carries | `on_fail="fix"` | `on_fail="exception"` |
129
+ |---|---|---|---|
130
+ | `allow` | nothing, it passes | value unchanged | value unchanged |
131
+ | `redact` | `fix_value` and the spans | the redacted value | raises |
132
+ | `deny` | the spans, no `fix_value` | `validation_passed` is False and `validated_output` is None | raises |
133
+
134
+ Measured on guardrails-ai 0.11.0: `on_fail="fix"` over a `FailResult` with no
135
+ `fix_value` does not raise and does not pass the original through. It sets
136
+ `validation_passed` to False and `validated_output` to None. That is the right
137
+ answer and a quiet one, so **put deny-class checks under
138
+ `on_fail="exception"`**. There is no fix for a deny, and a caller that reads
139
+ `validated_output` without reading `validation_passed` gets `None` rather than a
140
+ signal.
141
+
142
+ The chain's own content on a deny is never offered as a `fix_value`.
143
+ `GuardrailChain`'s docstring is explicit that on a deny that string exists for
144
+ the audit record and is not safe to send.
145
+
146
+ ## What the failure carries
147
+
148
+ `error_message` names the validator, the decision and the finding types, for
149
+ example:
150
+
151
+ ```
152
+ jamjet/chain[pii,secrets]: redact (pii:CREDIT_CARD, secrets:SLACK_TOKEN)
153
+ ```
154
+
155
+ `error_spans` carries one `ErrorSpan` per located finding, with `start` and `end`
156
+ indexing the value that was validated and `reason` naming the detector and the
157
+ finding type.
158
+
159
+ Neither ever quotes the content. If a check itself fails, the message carries the
160
+ exception's type name and the SHA-256 of what was inspected, and not the
161
+ exception's message: an exception message routinely quotes the value that caused
162
+ it, and that value is the content.
163
+
164
+ ## Direction and origin
165
+
166
+ Every validator takes `direction` (`"input"` or `"output"`, default `"output"`)
167
+ and `origin` (default `"model"`). They reach the check as its `Context`, they are
168
+ recorded on every verdict, and some checks decide differently per direction.
169
+ Validating a user's message rather than a model's reply means
170
+ `JamJetChain(checks=[...], direction="input", origin="user")`.
171
+
172
+ Any `metadata` a Guard passes is forwarded to the check as `Context.metadata`.
173
+
174
+ ## Licence
175
+
176
+ Apache-2.0.
177
+
178
+ ## The framework this adapter installs makes network calls
179
+
180
+ `jamjet-guardrails` says on its own front page: no dependencies, no network
181
+ calls, no model downloads. That is true of the core and it stops being true of
182
+ your environment the moment you install this adapter, so it is said here rather
183
+ than left for you to find.
184
+
185
+ Measured on `guardrails-ai` 0.11.0: it posts usage metrics unless
186
+ `settings.rc.enable_metrics` is false, and it builds an OpenTelemetry batch span
187
+ exporter AT IMPORT whose flush happens at interpreter exit. On a machine with no
188
+ route to the endpoint, that flush is several seconds of OTLP retries at the end
189
+ of every process; on a machine with one, it is a report.
190
+
191
+ Both are yours to turn off, and the ORDER matters, because the exporter is built
192
+ during import:
193
+
194
+ ```python
195
+ import os
196
+ os.environ["OTEL_SDK_DISABLED"] = "true" # before importing guardrails
197
+
198
+ from guardrails import settings
199
+ settings.rc.enable_metrics = False
200
+ settings.disable_tracing = True
201
+ ```
202
+
203
+ `tests/conftest.py` in this package does exactly that, for the same reason.
204
+
205
+ Nothing in this adapter sends anything anywhere. The spans and messages it
206
+ returns go back to the host in-process.
@@ -0,0 +1,177 @@
1
+ # jamjet-guardrails-validators
2
+
3
+ [Guardrails AI](https://github.com/guardrails-ai/guardrails) validators backed by
4
+ [jamjet-guardrails](https://github.com/jamjet-labs/jamjet-guardrails), a
5
+ zero-dependency library of deterministic content checks with published precision
6
+ and recall.
7
+
8
+ Installed from PyPI, not from the Guardrails Hub, which is closed. Every
9
+ validator here is an ordinary pip install.
10
+
11
+ ## Install
12
+
13
+ ```
14
+ pip install jamjet-guardrails-validators
15
+ ```
16
+
17
+ Requires Python 3.10 to 3.13, the range `guardrails-ai` itself supports.
18
+
19
+ ## Use the composite
20
+
21
+ ```python
22
+ from guardrails import Guard
23
+ from jamjet_guardrails_validators import JamJetChain
24
+
25
+ guard = Guard().use(JamJetChain(checks=["pii", "secrets"], on_fail="fix"))
26
+
27
+ outcome = guard.validate("SLACK_BOT_TOKEN=xoxb-0000000000-2000000000008-EXAMPLEONLYnotarealtoken")
28
+ outcome.validated_output
29
+ # 'SLACK_BOT_TOKEN=[REDACTED:CREDIT_CARD+SLACK_TOKEN]'
30
+ ```
31
+
32
+ ## Why one validator and not two
33
+
34
+ Stacking `jamjet/pii` and `jamjet/secrets` as two validators is not the same
35
+ thing, and the difference is a leak rather than a preference. Measured on
36
+ guardrails-ai 0.11.0, which has two validator services and picks between them
37
+ without asking.
38
+
39
+ **The sequential service** (`GUARDRAILS_RUN_SYNC=true`) hands each validator the
40
+ previous validator's `fix_value`. Over the token above, with `jamjet/pii` first,
41
+ the guard reports `validation_passed=True` and returns:
42
+
43
+ ```
44
+ SLACK_BOT_TOKEN=[REDACTED:SLACK_TOKEN][REDACTED:CREDIT_CARD]-EXAMPLEONLYnotarealtoken
45
+ ```
46
+
47
+ The 13-digit middle segment is Luhn-valid and begins with a 2, so the PII check
48
+ reads it as a payment card and redacts it first. That placeholder splits the
49
+ token in half. The secrets check then matches only the 16-character prefix, and
50
+ the 24-character secret tail survives into a value the guard calls valid.
51
+
52
+ **The default async service** runs every validator over the original value and
53
+ combines the fixes with a three-way merge. That closes the stump above and opens
54
+ something worse: a `FailResult` with no `fix_value`, which is what a deny is, is
55
+ outvoted by one that carries a fix. Stacking `jamjet/injection-structural` with
56
+ `jamjet/pii` under `on_fail="fix"`, over a string carrying both an address and a
57
+ tag-character injection payload, returns `validation_passed=False` in one order
58
+ and `validation_passed=True` with the payload intact in the other.
59
+
60
+ `JamJetChain` has neither failure because it does not compose fixes at all. It
61
+ runs one chain, which hands every check the same original string, merges every
62
+ redaction in a single pass over that string, and combines decisions restrictively
63
+ so a later check cannot talk an earlier deny back down to a pass. The host gets
64
+ one `FailResult` with one `fix_value`, and the placeholder names every check that
65
+ claimed the region: `[REDACTED:CREDIT_CARD+SLACK_TOKEN]` rather than one of the
66
+ two.
67
+
68
+ The per-check validators exist for a caller composing a single check. If you want
69
+ two, use the composite.
70
+
71
+ ## Which checks you can name
72
+
73
+ `checks` takes any check the installed `jamjet-guardrails` registers. That list
74
+ grows with the core library, so read it from the library rather than from this
75
+ page:
76
+
77
+ ```python
78
+ from jamjet_guardrails_validators import VALIDATORS
79
+ sorted(VALIDATORS)
80
+ ```
81
+
82
+ `VALIDATORS` is generated from `jamjet_guardrails.detectors.AVAILABLE` at import,
83
+ so a check added to the core is a validator here with no edit. A single check:
84
+
85
+ ```python
86
+ from jamjet_guardrails_validators import validator_for
87
+
88
+ guard = Guard().use(validator_for("pii")(on_fail="fix"))
89
+ ```
90
+
91
+ A check that takes options is configured through `options`, keyed by check name:
92
+
93
+ ```python
94
+ JamJetChain(checks=["secrets"], options={"secrets": {"on_match": "deny"}}, on_fail="exception")
95
+ ```
96
+
97
+ ## Choosing `on_fail`
98
+
99
+ | Chain decision | `FailResult` carries | `on_fail="fix"` | `on_fail="exception"` |
100
+ |---|---|---|---|
101
+ | `allow` | nothing, it passes | value unchanged | value unchanged |
102
+ | `redact` | `fix_value` and the spans | the redacted value | raises |
103
+ | `deny` | the spans, no `fix_value` | `validation_passed` is False and `validated_output` is None | raises |
104
+
105
+ Measured on guardrails-ai 0.11.0: `on_fail="fix"` over a `FailResult` with no
106
+ `fix_value` does not raise and does not pass the original through. It sets
107
+ `validation_passed` to False and `validated_output` to None. That is the right
108
+ answer and a quiet one, so **put deny-class checks under
109
+ `on_fail="exception"`**. There is no fix for a deny, and a caller that reads
110
+ `validated_output` without reading `validation_passed` gets `None` rather than a
111
+ signal.
112
+
113
+ The chain's own content on a deny is never offered as a `fix_value`.
114
+ `GuardrailChain`'s docstring is explicit that on a deny that string exists for
115
+ the audit record and is not safe to send.
116
+
117
+ ## What the failure carries
118
+
119
+ `error_message` names the validator, the decision and the finding types, for
120
+ example:
121
+
122
+ ```
123
+ jamjet/chain[pii,secrets]: redact (pii:CREDIT_CARD, secrets:SLACK_TOKEN)
124
+ ```
125
+
126
+ `error_spans` carries one `ErrorSpan` per located finding, with `start` and `end`
127
+ indexing the value that was validated and `reason` naming the detector and the
128
+ finding type.
129
+
130
+ Neither ever quotes the content. If a check itself fails, the message carries the
131
+ exception's type name and the SHA-256 of what was inspected, and not the
132
+ exception's message: an exception message routinely quotes the value that caused
133
+ it, and that value is the content.
134
+
135
+ ## Direction and origin
136
+
137
+ Every validator takes `direction` (`"input"` or `"output"`, default `"output"`)
138
+ and `origin` (default `"model"`). They reach the check as its `Context`, they are
139
+ recorded on every verdict, and some checks decide differently per direction.
140
+ Validating a user's message rather than a model's reply means
141
+ `JamJetChain(checks=[...], direction="input", origin="user")`.
142
+
143
+ Any `metadata` a Guard passes is forwarded to the check as `Context.metadata`.
144
+
145
+ ## Licence
146
+
147
+ Apache-2.0.
148
+
149
+ ## The framework this adapter installs makes network calls
150
+
151
+ `jamjet-guardrails` says on its own front page: no dependencies, no network
152
+ calls, no model downloads. That is true of the core and it stops being true of
153
+ your environment the moment you install this adapter, so it is said here rather
154
+ than left for you to find.
155
+
156
+ Measured on `guardrails-ai` 0.11.0: it posts usage metrics unless
157
+ `settings.rc.enable_metrics` is false, and it builds an OpenTelemetry batch span
158
+ exporter AT IMPORT whose flush happens at interpreter exit. On a machine with no
159
+ route to the endpoint, that flush is several seconds of OTLP retries at the end
160
+ of every process; on a machine with one, it is a report.
161
+
162
+ Both are yours to turn off, and the ORDER matters, because the exporter is built
163
+ during import:
164
+
165
+ ```python
166
+ import os
167
+ os.environ["OTEL_SDK_DISABLED"] = "true" # before importing guardrails
168
+
169
+ from guardrails import settings
170
+ settings.rc.enable_metrics = False
171
+ settings.disable_tracing = True
172
+ ```
173
+
174
+ `tests/conftest.py` in this package does exactly that, for the same reason.
175
+
176
+ Nothing in this adapter sends anything anywhere. The spans and messages it
177
+ returns go back to the host in-process.