Structured output contract testing for LLM systems
Project description
locc - LLM Output Contract Check
Structured output contract testing for LLM systems. Define what your LLM must output. locc tells you when it drifts.
Install
pip install locc
Quickstart
locc run \
--contract examples/contract.json \
--snapshot examples/snapshot.json \
--output json
What it checks
- Schema conformance: required fields, types, enum values
- Snapshot diff: what changed between runs
- Contract violations: hard constraints your LLM must satisfy
Output
Sample JSON artifact:
{
"status": "FAIL",
"checks": [
{
"name": "schema_conformance",
"result": "FAIL",
"reason": "Missing required field: category"
}
],
"diff": {
"category": {
"expected": "billing",
"actual": null
}
}
}
Exit codes
| Code | Meaning |
|---|---|
| 0 | PASS |
| 1 | HOLD |
| 2 | FAIL |
GitHub Actions
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install locc
- run: |
locc run \
--contract contracts/current.json \
--snapshot snapshots/current.json \
--output json > locc_result.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: locc-result
path: locc_result.json
Stack integration
locc is part of the LLM Reliability Stack. locc output feeds Release Governor for staging-time promotion gating.
| Stage | Component |
|---|---|
| Design-time | PFA |
| CI | locc |
| Staging | Release Governor |
| Runtime | EGA |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_locc-1.1.0.tar.gz.
File metadata
- Download URL: llm_locc-1.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa4febdece1cd275fac34fb9cc0f529f6c521c7b2b74b9237669be124a9a164
|
|
| MD5 |
477e38e06174cc7c0295a4833d7da5a3
|
|
| BLAKE2b-256 |
2d2306f4cca5f1f60c161683b62a8c21b2c6315187f6ca865b02fce2ee0b0438
|
Provenance
The following attestation bundles were made for llm_locc-1.1.0.tar.gz:
Publisher:
publish.yml on bh3r1th/llm-output-contract-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_locc-1.1.0.tar.gz -
Subject digest:
5aa4febdece1cd275fac34fb9cc0f529f6c521c7b2b74b9237669be124a9a164 - Sigstore transparency entry: 1456717077
- Sigstore integration time:
-
Permalink:
bh3r1th/llm-output-contract-check@ca0b849315d98ed442176940dab01f32bc0d4bea -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/bh3r1th
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca0b849315d98ed442176940dab01f32bc0d4bea -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_locc-1.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_locc-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c20e5444db2e7cb10f196ea13153725b336eb2679be10fe5e84c4a3e65e6a1
|
|
| MD5 |
0b3e520d03708ded9c7a395cea26a5d3
|
|
| BLAKE2b-256 |
e4febe9d2d27ad6ba8207a495caf6fc997e6088ae7ae56bb1873632ce972950e
|
Provenance
The following attestation bundles were made for llm_locc-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on bh3r1th/llm-output-contract-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_locc-1.1.0-py3-none-any.whl -
Subject digest:
80c20e5444db2e7cb10f196ea13153725b336eb2679be10fe5e84c4a3e65e6a1 - Sigstore transparency entry: 1456717215
- Sigstore integration time:
-
Permalink:
bh3r1th/llm-output-contract-check@ca0b849315d98ed442176940dab01f32bc0d4bea -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/bh3r1th
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca0b849315d98ed442176940dab01f32bc0d4bea -
Trigger Event:
push
-
Statement type: