Skip to main content

Python (Pydantic v2) distribution of @intentsolutions/core — the canonical contracts kernel for the Intent Eval Platform. The same entity + predicate contracts the TypeScript package exposes as Zod validators + JSON Schemas, as Pydantic v2 models.

Project description

intent-eval-core (Python)

Python (Pydantic v2) distribution of @intentsolutions/core — the canonical contracts kernel for the Intent Eval Platform.

The same entity + predicate contracts the TypeScript package exposes as Zod validators and JSON Schemas, here as Pydantic v2 models for Python consumers. The models are code-generated from the canonical schemas/v1/*.json JSON Schemas and validated for parity against the same golden fixtures the TypeScript/AJV side validates — a payload accepted by the Zod validator is accepted here, and one rejected there is rejected here.

Install

pip install intent-eval-core

Requires Python 3.10+. Runtime dependency: pydantic>=2.5,<3.

Usage

from intent_eval_core import GateResultV1, EvalSpec
from pydantic import ValidationError

row = {
    "gate_id": "audit-harness:ci:escape-scan",
    "gate_name": "escape-scan",
    "gate_version": "0.3.0",
    "gate_decision": "pass",
    "gate_reasons": [],
    "coverage": {"dimensions_evaluated": ["credential-leak"], "dimensions_skipped": []},
    "policy_ref": "sha256:" + "e" * 64 + ":tests/TESTING.md",
    "policy_hash": "sha256:" + "e" * 64,
    "input_hash": "sha256:" + "3" * 64,
    "evaluated_at": "2026-05-17T00:00:10Z",
    "runner": "audit-harness@0.3.0",
    "commit_sha": "abc1234",
}

gate = GateResultV1.model_validate(row)   # raises pydantic.ValidationError on drift
print(gate.gate_decision)                 # GateDecision.pass_

What's exported

13 canonical entities + 3 predicate bodies (Blueprint B § 2 / § 7):

Entity models Predicate-body models
EvalSpec, EvalRun, MatcherMap, EvidenceBundle, JudgeDecision, RuntimeReceipt, RegressionPack, RolloutGate, SkillSnapshot, SessionTrace, ToolInvocation, CostRecord, FailureTaxonomy GateResultV1, RetractionV1, DashboardRenderV1

Plus GATE_RESULT_V1_URI (the canonical predicate URI at evals.intentsolutions.io).

How it stays in lockstep with the TypeScript kernel

  • Codegen, not hand-portscripts/codegen_pydantic.py runs datamodel-code-generator (pinned) over the canonical schemas/v1/*.json. The output lives in intent_eval_core/_generated/ (reference material; never import from it directly).
  • Cross-field rules — the JSON Schema allOf/if-then conditional rules (e.g. gate-result/v1's "advisory requires advisory_severity", "fail/advisory/error requires a non-empty reason") cannot be expressed by the generator, so the canonical public surface (intent_eval_core/models.py) layers a hand-written Pydantic model_validator on top — the exact mirror of the Zod .superRefine() blocks in the TypeScript validators.
  • Parity teststests/test_parity.py runs the shared golden fixtures (tests/fixtures/v1/, the same set the TypeScript suite consumes) through the Python models and asserts identical accept/reject behavior.
  • Version lockstep — the package version tracks the npm @intentsolutions/core package.json#version (the JSON Schemas are the shared source of truth). CI gate: scripts/check_version_lockstep.py.

License

Apache-2.0. See LICENSE and NOTICE.

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

intent_eval_core-0.8.0.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

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

intent_eval_core-0.8.0-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file intent_eval_core-0.8.0.tar.gz.

File metadata

  • Download URL: intent_eval_core-0.8.0.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for intent_eval_core-0.8.0.tar.gz
Algorithm Hash digest
SHA256 405bf85612ab1323e1ee5f3b608fb9bc3d95ac687421722ab0530dd0ead22cc7
MD5 427da50c2234145abfe4b04a0b2354ab
BLAKE2b-256 242f1a320adea4dc9b0e04644115dcf71e5ee385b5dc15f82b965e5bd3d7cfc4

See more details on using hashes here.

File details

Details for the file intent_eval_core-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for intent_eval_core-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e44238b3e12bcac971768562d88d0b1d4de2eda649b5362b5b62904def8d3ba0
MD5 be4972f1da2f08f5e3fb1c6d724865c5
BLAKE2b-256 53658c67b84617e652c1db0675e35b90dfa313f74852eb546431dd46cc994dc0

See more details on using hashes here.

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