Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_locc-1.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_locc-1.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

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

Hashes for llm_locc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5aa4febdece1cd275fac34fb9cc0f529f6c521c7b2b74b9237669be124a9a164
MD5 477e38e06174cc7c0295a4833d7da5a3
BLAKE2b-256 2d2306f4cca5f1f60c161683b62a8c21b2c6315187f6ca865b02fce2ee0b0438

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_locc-1.1.0.tar.gz:

Publisher: publish.yml on bh3r1th/llm-output-contract-check

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for llm_locc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80c20e5444db2e7cb10f196ea13153725b336eb2679be10fe5e84c4a3e65e6a1
MD5 0b3e520d03708ded9c7a395cea26a5d3
BLAKE2b-256 e4febe9d2d27ad6ba8207a495caf6fc997e6088ae7ae56bb1873632ce972950e

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page