Skip to main content

AI Hallucination Detector — Formally Verified Trust Scoring for LLM Outputs

Project description

TruthLens Python

AI Hallucination Detector — Formally Verified Trust Scoring for LLM Outputs

Python bindings for TruthLens, powered by PyO3.

Install

pip install truthlens

Usage

from truthlens import analyze, check_consistency, extract_claims, extract_entities

# Analyze text for hallucination risk
report = analyze("Einstein was born in 1879 in Ulm, Germany.")
print(f"Trust: {report['score']:.0%}{report['risk_level']}")

# Per-claim breakdown
for claim in report["claims"]:
    print(f"  {claim['text']}{claim['trust']['risk_level']}")

# Multi-response consistency check
result = check_consistency([
    "Einstein was born in 1879 in Ulm.",
    "Einstein was born in 1879 in Munich.",
])
print(f"Consistency: {result['consistency_score']:.0%}")
for c in result["contradictions"]:
    print(f"  Conflict: {c['claim_a']} vs {c['claim_b']}")

# Extract atomic claims
claims = extract_claims("Python was created in 1991. It is widely used.")
for c in claims:
    print(f"  [{c['specificity']:.2f}] {c['text']}")

# Extract named entities
entities = extract_entities("Marie Curie won the Nobel Prize in 1903.")
print(entities)  # ['1903', 'Marie Curie']

License

Apache-2.0

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

truthlens-0.6.0.tar.gz (40.9 kB view details)

Uploaded Source

Built Distributions

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

truthlens-0.6.0-cp313-cp313-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.13Windows x86-64

truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

File details

Details for the file truthlens-0.6.0.tar.gz.

File metadata

  • Download URL: truthlens-0.6.0.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for truthlens-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3fd81f80e05f5c0eb6f2e563df52c7dec253fa8acb3913401dbf836af47b8124
MD5 eafa89ab41e411b0f09f64386ebcaf16
BLAKE2b-256 4bacc1b9ed248d13444c60a5840f0212699e371bfd9a6e1117964ca65f603fd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0.tar.gz:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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

File details

Details for the file truthlens-0.6.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: truthlens-0.6.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for truthlens-0.6.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 94e58a64ea78fc5f81d18d34e9403d6e4893c90f8ed1a362c9d90fe04b5e1181
MD5 3e2f71923eec1c68ea7ebf0cee8d4a96
BLAKE2b-256 55271bc20bef61213b463231337389f49fb1aecc4a81236a1313b613d3bcab6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0-cp313-cp313-win_amd64.whl:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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

File details

Details for the file truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 194f1d6aed339e33e8be09abf58010bcbdc5ac53865c7c8df26278c73fafa4ce
MD5 a141848230a67683b8fff62ae6982696
BLAKE2b-256 b30c1f94ec03ea5cb612678867787be09071f2b4be0c96ced1350bd9841783c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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

File details

Details for the file truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d43d50ef733234eeb22f8bf51bde4e2b480377bf0e0e8f886830f82b72f6bbd7
MD5 8dedeb6a0d1092f3e05de57585e61540
BLAKE2b-256 4466869553344040b1274ad67b873bb8e28a9641ef414b8a0e50937e4ac9871d

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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

File details

Details for the file truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3ea6d4b9fb8c8146f5680090efec1fc41bd73ece99afa2e818145b675b6eebd
MD5 733268b9bf7df3614f181fe552dbf92d
BLAKE2b-256 30b10b25f2dee0b6352ce80402e17cb66b45e0e257170781893a7a7617a31733

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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

File details

Details for the file truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00fe8d8516b1c615f19de89132fdb5fe46ac3517ba2ec1f8833f7db880baf43a
MD5 28f89851ccae45164655a5957e8c9e52
BLAKE2b-256 225d880b99c369ac13495f64664b98f4f7cb3ebe0fb77e3758729e9750456c65

See more details on using hashes here.

Provenance

The following attestation bundles were made for truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish.yml on yablokolabs/truthlens

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