Skip to main content

groundanchor

Deterministic factual grounding and hallucination verification engine for AI agents and RAG pipelines.

Engineered for production teams needing fast, sub-millisecond, zero-API-cost verification of LLM responses against source documents without relying on slow or non-deterministic LLM-as-a-judge calls.


Key Capabilities

  • Zero-API-Cost & Ultra-Low Latency: Pure deterministic Python engine running in sub-50 milliseconds on CPU.
  • Numerical & Entity Anchor Verification: Detects subtle numerical contradictions (e.g. source says 14%, LLM generates 18%), currency discrepancies, and unauthorized entity insertions.
  • Polarity & Negation Check: Catches negation inversions (e.g. source states "service is not supported", LLM generates "service is supported").
  • Attribution Index: Computes composite lexical overlap, longest common subsequence, and Okapi BM25 citation scores.
  • Automatic Sanitization: Strips ungrounded claims on the fly, outputting only verified statements.
  • Drop-in Guardrail Decorator: @groundanchor.guard decorates sync and async LLM functions with raise, sanitize, or warn policies.

Installation

pip install groundanchor

Quickstart

import groundanchor

sources = [
    "EdgeMind is an open-source Python SDK engineered for local AI image generation. "
    "It supports 1-step Hyper-SD acceleration and runs natively on Windows, Linux, and macOS."
]

response = (
    "EdgeMind is a Python SDK for local AI image generation supporting 1-step acceleration. "
    "It was acquired by an offshore entity for $500M."
)

report = groundanchor.verify(sources=sources, response=response)

print(f"Is Grounded: {report.is_grounded}")        # False
print(f"Grounding Score: {report.grounding_score}")  # 0.48
print(f"Risk Level: {report.risk_level.value}")     # ungrounded

# Sanitize to keep only verified claims:
print(report.sanitized_response())
# Output: "EdgeMind is a Python SDK for local AI image generation supporting 1-step acceleration."

Production Guardrail Decorator

from groundanchor import guard, GroundingViolationError

@guard(threshold=0.80, action="sanitize")
def answer_rag(sources: list[str], question: str) -> str:
    # Any LLM call here (OpenAI, Anthropic, Ollama, local models)
    return llm.generate(sources, question)

CLI Usage

Audit responses directly in CI/CD or shell pipelines:

groundanchor verify --context docs.txt --response output.txt --threshold 0.75
groundanchor sanitize --context docs.txt --response output.txt
groundanchor redline --context docs.txt --response output.txt

License

MIT License.

Metadata

Release files for groundanchor 0.1.0

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

Source distribution (sdist)

Source distribution for groundanchor 0.1.0
File Size Uploaded Provenance Actions
groundanchor-0.1.0.tar.gz 22.2 kB Without provenance Details for groundanchor-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for groundanchor 0.1.0
File Interpreter ABI Platform Actions
groundanchor-0.1.0-py3-none-any.whl Python 3 none any Details for groundanchor-0.1.0-py3-none-any.whl

Total release size: 43.5 kB

Release files / groundanchor-0.1.0.tar.gz

Download URL groundanchor-0.1.0.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0b34e237ea81b03f01f73287b476eb4e73f0466f29dca78e595843a80a93eeb4
BLAKE2b-256 checksum
How to use checksums
48de5644eef0ef337a8bc8a343c29fb924de4203885ac559efbaf39dfcb729f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / groundanchor-0.1.0-py3-none-any.whl

Download URL groundanchor-0.1.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e4bc4c394a8e3b27913428ad43fa43dc336877af16768ea38d9de6dc1f87df5
BLAKE2b-256 checksum
How to use checksums
f1d870e508128b22c0efb1babeba186ab18ce98d5dce6ea8b8fe5f6d2184bb3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for groundanchor 0.1.0

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.0 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