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.3.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.6 MB
Release files / crocotiger_engine-0.3.0-cp313-cp313-win_amd64.whl
| Download URL | crocotiger_engine-0.3.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
37d28550a874e5e98514f302af5d9b3e9c5f1cd00fd02a20bd1bf5483563ed0f
|
|
BLAKE2b-256 checksum How to use checksums |
62b399f8f040a08b74e43e1a74a4f22d70e1d7abd3dccd9c0d51c61da1ee0b5c
|
| 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.3.0-cp313-cp313-win32.whl
| Download URL | crocotiger_engine-0.3.0-cp313-cp313-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
07875b4c2fafefa18bd896505fdb335691697c60f336f56f10cc33fe6b7d93a7
|
|
BLAKE2b-256 checksum How to use checksums |
b4638992239c09487e9f9dc29829cd24d7ecd1748481335d3d4cfcd7e33ca1aa
|
| 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.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2730f01270978b85b0d63957477190cb9cdbbc81b9c6e7f5ea4481028fed3861
|
|
BLAKE2b-256 checksum How to use checksums |
8e83123f9db3e031c8e6cedb34e653a74ee134c9d1f3bd8e63b09043ca72b0c7
|
| 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.3.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.3.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 |
b992e30abfe715131e94666469547c3dc3e1759b46c241d51fadcbca6c40cfc0
|
|
BLAKE2b-256 checksum How to use checksums |
e01908b69807b0f5e7b08b256184e2c1eb82d8f1f42c5612fffd546be35a87bd
|
| 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.3.0-cp312-cp312-win_amd64.whl
| Download URL | crocotiger_engine-0.3.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
acf88bb02fa6396add844285366e212d11614ee9dbcefc7667cd91f3aa39b491
|
|
BLAKE2b-256 checksum How to use checksums |
1ab3820d61f7096d73ffe94ed6f844fe9a5766a9e43cea6d6187ef4f67874890
|
| 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.3.0-cp312-cp312-win32.whl
| Download URL | crocotiger_engine-0.3.0-cp312-cp312-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
44f52b3a4423f6bdab95d550a1bf91fef311b55a30baa40f12df7d1c460d704b
|
|
BLAKE2b-256 checksum How to use checksums |
eb6931cfc1c449e3f91acd0ac353822adc4f29e9cfbb88e2fff65992c2dd9408
|
| 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.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.7 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8c13a48ddbd84a0e5d943f6acfb972d5e9148d2963b3b818089dd22d3e8029b0
|
|
BLAKE2b-256 checksum How to use checksums |
f350a00f6988b55b109979f719000e10750c8bdb3015fbdea8f00ab0455fe731
|
| 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.3.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.3.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 |
565cad95633a918d59ba01de4485036f4969bf99c818f91d67243e4455b8626c
|
|
BLAKE2b-256 checksum How to use checksums |
c8995ea0c10ce885a1267e9c469b667033144b0684c4092b9d7bb5d7dbd4cb65
|
| 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.3.0-cp311-cp311-win_amd64.whl
| Download URL | crocotiger_engine-0.3.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f01a1122c386d639b8fbd09c39b87ca2d909c2212e2d34a8a845f144ec4731cb
|
|
BLAKE2b-256 checksum How to use checksums |
13384674d6ef964fd698fe96dd0149d80eeb3619451189b482178282125f31d4
|
| 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.3.0-cp311-cp311-win32.whl
| Download URL | crocotiger_engine-0.3.0-cp311-cp311-win32.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
2df0186506766e81db20d87be28a088972b5ef879d4329ffe00663611a8e6e64
|
|
BLAKE2b-256 checksum How to use checksums |
c672db4704dddd692f2513633c5ddfbc1b0094a51f707bb25c8d8591a33aa5b2
|
| 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.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crocotiger_engine-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b0859b241e7107eab20f770d722c970891d8f94e75950cd706d047acfd3914c7
|
|
BLAKE2b-256 checksum How to use checksums |
231ef56637954f93b54ed8812089256704928ea0bee557b776f93b78bd429bba
|
| 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.3.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | crocotiger_engine-0.3.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 |
8580ce08526caad7b598697e5225dceb008955bcb510489d308d5326ee3830af
|
|
BLAKE2b-256 checksum How to use checksums |
71c42c8b2e3148e989af56583468fae5e573bbac28c9a91a6c2f7846f2cc58e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|