Skip to main content

llm-drift-ctl (Python)

llm-drift-ctl is a drop-in guard that validates LLM outputs using your own LLM when needed — and no LLM when not.

Production-grade LLM output validation package for Python. This package does NOT generate content. It validates LLM outputs after they are produced.

Installation

pip install llm-drift-ctl

Quick Start

FORMAT Mode (LLM-free, fully offline)

from llm_drift_ctl import DriftGuard, DriftGuardConfig

guard = DriftGuard(DriftGuardConfig(pipeline_id="my-pipeline"))

# Check JSON format (using keyword arguments)
result = await guard.check(
    json={"name": "John", "age": 30},
    mode="FORMAT"
)

# Or using CheckInput object
from llm_drift_ctl import CheckInput
result = await guard.check(
    CheckInput(json={"name": "John", "age": 30}, mode="FORMAT")
)

print(result)
# CheckResult(
#     block=False,
#     decision='ALLOW',
#     severity='LOW',
#     scores={'format': 1.0},
#     where=[]
# )

CONTENT Mode (requires your LLM)

from llm_drift_ctl import DriftGuard, DriftGuardConfig, UserLLM

# Implement your LLM adapter
class MyLLM(UserLLM):
    async def generate(self, prompt, text=None, json=None):
        # Call OpenAI, Gemini, Claude, or your custom LLM
        # You provide your own API key
        return "response from your LLM"

guard = DriftGuard(DriftGuardConfig(
    pipeline_id="my-pipeline",
    llm=MyLLM(),
    api_key="your-license-key"  # for cloud license verification
))

# Accept a baseline (approved output)
await guard.accept_baseline(json={"name": "John", "age": 30})

# Check against baseline
result = await guard.check(
    json={"name": "Jane", "age": 25},
    mode="CONTENT"
)

API Reference

See the main README.md for full documentation.

The Python API mirrors the Node.js API exactly.

License

MIT

Metadata

Release files for llm-drift-ctl 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-drift-ctl 0.1.2
File Size Uploaded Provenance
llm_drift_ctl-0.1.2.tar.gz 9.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-drift-ctl 0.1.2
File Interpreter ABI Platform
llm_drift_ctl-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / llm_drift_ctl-0.1.2.tar.gz

Download URL llm_drift_ctl-0.1.2.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee78d7bd517d54fdf53690b21f1e4e1a351ec65e4389dbe3ead694c899591396
BLAKE2b-256 checksum
How to use checksums
7f87717bc92c1981cf13afca9ffdc99a7e642de313dc3d438fb1030add7ee4b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / llm_drift_ctl-0.1.2-py3-none-any.whl

Download URL llm_drift_ctl-0.1.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3243ace2a58f4b811196443fe2b470b27ab15d6965ae6e163333dce19a1dfb0
BLAKE2b-256 checksum
How to use checksums
4c1a943e3248572a47f327e0071d7fd214cae8e69d4a83c9293b5414047f1cd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for llm-drift-ctl 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page