Skip to main content

phm-lite-check

Deterministic physics plausibility checking for LLM outputs and robotics / embodied-AI datasets. Zero dependencies, pure standard library, Python >= 3.8.

This package is an independent, community-provided library: it is the offline subset of the PHM physical-judgment engine (proprietary core methods are intentionally excluded). A companion plugin (phm-physics-check) is listed on the Dify Marketplace.

Not affiliated with, endorsed by, or sponsored by LangChain, AutoGen, or Dify. Integration adapters are community-provided.

MCP server

This package doubles as a local MCP server (stdio transport). After installing, point your MCP client at:

python3 -m phm_lite_check.mcp_server

Exposing three tools: physics_text_check, physics_quantity_check, robotics_data_check.

What it checks

Text / quantities (check_text, full_check)

  • Dimensional / unit consistency (SI + common units)
  • Universal speed limit (c)
  • Absolute temperature floor (0 K)
  • Non-negativity of mass / length / energy
  • Probability range [0, 1]
  • Kinematic relations (free-fall family, tolerance-checked)
  • Conservation checks (energy / momentum, tolerance-checked)

Robotics records (check_robotics_record)

  • Quaternion normalization (|q| within tolerance of 1.0)
  • Timestamp sanity: monotonicity, duplicates, NaN/Inf, outlier gaps (possible frame loss)
  • NaN / Inf scan over numeric arrays
  • Unit annotation presence for common motion fields

Design guarantees

  • Deterministic: same input -> same output, always reproducible.
  • Zero dependencies: pure standard library; framework adapters import their host lazily.
  • Verdicts: PASS / WARN / FAIL with structured violation records.
  • No network calls: everything runs offline in-process.

NOTE: this package contains only the deterministic offline subset of the PHM physical-judgment engine. Proprietary core methods are intentionally excluded. (Deployment-specific deep checks are available separately via a configurable remote engine endpoint, not included in this package.)

Install

Option A — from the GitHub repo (no package index needed):

pip install git+https://github.com/PHM-Audit/phm-lite-check

Option B — from a Release wheel (faster, no git clone):

pip install https://github.com/PHM-Audit/phm-lite-check/releases/download/v1.0.0/phm_lite_check-1.0.0-py3-none-any.whl

Optional extras (once installed):

pip install "phm-lite-check[langchain]"   # + langchain-core (adapter tests)
pip install "phm-lite-check[autogen]"     # + autogen-agentchat

PyPI listing is planned; both options above work today.

Quickstart — library

from phm_lite_check import check_text, check_robotics_record

check_text("The drone descends at 450 km/h and confidence is 1.8.")
# {"verdict": "FAIL", "violations": [...], ...}

check_robotics_record({
    "quaternion": [1.395, 0.0, 0.0, 0.0],   # |q| >> 1 -> FAIL
    "timestamps": [0.0, 0.1, 0.05],          # not monotonic -> FAIL
    "position": [1.0, 2.0],                  # no unit annotated -> WARN
})

Quickstart — LangChain

from phm_lite_check.integrations import langchain_tool

tools = langchain_tool.get_langchain_tools()   # 3 @tool callables
agent = create_react_agent(llm, tools)         # your usual wiring

Quickstart — AutoGen (v0.4+)

from autogen_agentchat.agents import AssistantAgent
from phm_lite_check.integrations import autogen_tool

assistant = AssistantAgent(
    name="checked_assistant",
    model_client=...,                    # your model client
    tools=autogen_tool.get_autogen_tools(),
)

Tools exposed by both adapters

Tool Input Checks
physics_text_check free text with quantities unit consistency, limits, probabilities
physics_quantity_check value + unit one quantity against physical law
robotics_data_check JSON record quaternions, timestamps, NaN/Inf, units

Tests

pip install -e ".[dev]"
pytest tests/ -q

License

MIT

Metadata

Release files for phm-lite-check 1.0.1

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

Source distribution (sdist)

Source distribution for phm-lite-check 1.0.1
File Size Uploaded Provenance Actions
phm_lite_check-1.0.1.tar.gz 16.9 kB Without provenance Details for phm_lite_check-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phm-lite-check 1.0.1
File Interpreter ABI Platform Actions
phm_lite_check-1.0.1-py3-none-any.whl Python 3 none any Details for phm_lite_check-1.0.1-py3-none-any.whl

Total release size: 33.3 kB

Release files / phm_lite_check-1.0.1.tar.gz

Download URL phm_lite_check-1.0.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
88abbcab42c71d680667c2832f0a73db44ea5ddb2d1ffd1e9e7663f61cf196ef
BLAKE2b-256 checksum
How to use checksums
b55eea13fc60a00b48c5854b1501b16c09410e000ba673bcb55f1733ae313e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / phm_lite_check-1.0.1-py3-none-any.whl

Download URL phm_lite_check-1.0.1-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59ee1f6f5e3505aba8ce30c3d340f97f1a605e3e4b8a1b4e797c1460cccc86a3
BLAKE2b-256 checksum
How to use checksums
1c48dc7569b52ed88427d4fde1aa987e0d3dabff8ad7f657db0e11461f12af7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for phm-lite-check 1.0.1

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.

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