crocotiger-engine
Sentence-level prompt guardrail — a compiled binary engine.
crocotiger-engine is the engine that powers the crocotiger
guardrail SDK.
Features
- Build a
SentenceValidatorfrom a topic description — LLM-driven accept/reject corpus generation, embedding, and threshold auto-tuning - Validate a prompt against the fitted validator, with a clear accept/reject decision
- Framework-agnostic — LangChain/LlamaIndex adapters live in the separate
crocotigerpackage
Installation
pip install crocotiger-engine
Prebuilt wheels are provided for CPython 3.11–3.13 on Linux, macOS, and Windows.
Quick start
Build or load a validator
Building is the slow, costly part (LLM calls to generate attack/topic datasets) — check for an existing artifact first and reuse it:
from pathlib import Path
from crocotiger_engine import build_sentence_validator, SentenceValidator
VALIDATOR_PATH = Path("./my-guardrail-build/sentence_validator")
if VALIDATOR_PATH.exists():
sentence_validator = SentenceValidator.load_from(str(VALIDATOR_PATH))
else:
sentence_validator = build_sentence_validator(
output_dir=VALIDATOR_PATH.parent,
topic="customer support for an online banking product",
context="a banking customer support assistant",
restricted_topics=["hacking or unauthorized system access"],
datasets_path="/path/to/your/dataset/corpus",
)
Validating a prompt directly
import asyncio
result = asyncio.run(sentence_validator.validate("How do I hack into a database?"))
result.valid # False means the prompt was blocked
result.reason_code # why it was accepted/rejected
SentenceValidatorResult at a glance
| Field | Type | Meaning |
|---|---|---|
valid |
bool |
False means the prompt was blocked |
reason_code |
str |
Why it was accepted/rejected |
duration |
float |
Validation time in milliseconds |
It's a plain object, not a dict. This is a deliberately trimmed view — the internal engine's result also carries per-call diagnostic detail (nearest matching list entries, internal classification), which isn't exposed here since it isn't meaningful outside the internal guardrail-builder product this engine is derived from.
get_options() at a glance
options = sentence_validator.get_options()
Returns a SentenceValidatorOptions with name, model_name, accept_threshold,
reject_threshold, review_criteria, use_density — config/tuning values only. It does
not include the raw accept/reject list content the validator was built from.
Credentials and data
- At least one of
OPENAI_API_KEY/GEMINI_API_KEY/DEEPSEEK_API_KEY— only needed the first time you build a validator (dataset generation). Loading a previously-built validator needs none of these. - A local dataset corpus — required only when building from scratch, not when loading an
existing validator.
build_sentence_validatordownloads it automatically from S3 on first use (bundled read-only-scoped credential).
Usage
Most users should install crocotiger, which
provides SentenceValidatorMiddleware/SentenceValidatorLLMGuard adapters that call the
same sentence_validator.validate() under the hood — wiring this into a LangChain agent or
a LlamaIndex query engine without calling .validate() yourself.
License
Commercial / proprietary. Use is governed by the TekDatum End User License Agreement. See the accompanying EULA. All rights reserved.
Metadata
Release files for crocotiger-engine 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 48.1 MB
Release files / crocotiger_engine-0.1.0-cp313-cp313-win_amd64.whl
| Download URL | crocotiger_engine-0.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3d135ec38f42c132fe53640181337c330c9e7e653d35daea6df419177ca821d8
|
|
BLAKE2b-256 checksum How to use checksums |
53c4ecd75518c5dda4dbbefcd27175da48996a47c973d1550c05942f5150a78f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp313-cp313-win32.whl
| Download URL | crocotiger_engine-0.1.0-cp313-cp313-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
2c52ac0fe7b6eb94029e11e5fba2742f9808466eb0461a36f5ebc3ec729808bf
|
|
BLAKE2b-256 checksum How to use checksums |
942981678f7b6ffdc707e4ff14a65c886c0113fdd54cb5df4131a1091ff14e15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3a8934a0bcaee8362d01de3da2f8c041b95436480f5d1939177a50cddd0c09a4
|
|
BLAKE2b-256 checksum How to use checksums |
742ef020450d0cc59111b71d3505cac0f9ef6ef252616eb62be1681b04612451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ab35a5e69c0ff680b26328e7011f3b366bc17ec2c496035d38ea2b69c40bf6d3
|
|
BLAKE2b-256 checksum How to use checksums |
4a5b2e3c5ac76025727a0d2e23647f0f66e9dcdcc240f3d366f1e42f143d503c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp312-cp312-win_amd64.whl
| Download URL | crocotiger_engine-0.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
47799d5fd811af4f2d45537e4a9f042bd211cfbac8d58a45f334c7d1194cee1a
|
|
BLAKE2b-256 checksum How to use checksums |
1d9abc2846e050f79f40fb3edf59bfbaa3211aebd337290ca5f2782361e8600c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp312-cp312-win32.whl
| Download URL | crocotiger_engine-0.1.0-cp312-cp312-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
d1fbca2d82ee4c7c79e82b64c30a7ff67078fbc4bd28c0211c3e99d28afee067
|
|
BLAKE2b-256 checksum How to use checksums |
bff06f143d08262be284e019260f0a648cc50fbaec05a8e3773e454f262fe46f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.6 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
fa23a83b13cd619bc88a0d0a7e9ede5cb4bdabbd1289ad9a502c172bf29162ac
|
|
BLAKE2b-256 checksum How to use checksums |
061693509183da9a2a69506086d360235fd451d6ad2dcd318c9e542455d61d3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e15a32ed6ac003a71592385ad50935a7b6bd1b4572bfd80ea82460be7690fb38
|
|
BLAKE2b-256 checksum How to use checksums |
e5ee3ef7b5eb7a77e9b5f5fc6af4c703053dbf652b0708073eae3f8e536ad3b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | crocotiger_engine-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
339a0564228fc73276db5787e0baf6b982edf5e78eb26f7b71bcfcedae0b4e91
|
|
BLAKE2b-256 checksum How to use checksums |
3846eabb57d7c395f5633d1fe3b3a65cc6aba5516c0a9a3081f0b25e4f4b3f47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp311-cp311-win32.whl
| Download URL | crocotiger_engine-0.1.0-cp311-cp311-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
7699d6966dd8cd7e68f456c03fc11f3c31309f8969372fe6c76d65a457b65d89
|
|
BLAKE2b-256 checksum How to use checksums |
0d89f7c9ecb68a345bd2c2d95a33a3f9723d8e2eef4b2e7e686dd264f637f6bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a0e2c3c1fd3040118bfd2214c250c900a31eefbd4b572e87e1fb8334ff65bc2f
|
|
BLAKE2b-256 checksum How to use checksums |
99e203b71019c3fd63488fbfad9e576f8e263726e212a087c5c99f5ca94352c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / crocotiger_engine-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9dc44e4a23f36e8256c0b764b9c9b904a372b6c7a13c219e5965abfefee8a4f5
|
|
BLAKE2b-256 checksum How to use checksums |
38a1d18f8fa36005ee25cb78c66c15877311cc1803cbc5b9532c6a8c5f34e50c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|