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
Release files for truthlens 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| truthlens-0.6.0.tar.gz | 40.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| truthlens-0.6.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.17+ x86-64 | Details |
| truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64 | Details |
| truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 10.4 MB
Release files / truthlens-0.6.0.tar.gz
| Download URL | truthlens-0.6.0.tar.gz |
|---|---|
| Size | 40.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fd81f80e05f5c0eb6f2e563df52c7dec253fa8acb3913401dbf836af47b8124
|
|
BLAKE2b-256 checksum How to use checksums |
4bacc1b9ed248d13444c60a5840f0212699e371bfd9a6e1117964ca65f603fd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency logRelease files / truthlens-0.6.0-cp313-cp313-win_amd64.whl
| Download URL | truthlens-0.6.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
94e58a64ea78fc5f81d18d34e9403d6e4893c90f8ed1a362c9d90fe04b5e1181
|
|
BLAKE2b-256 checksum How to use checksums |
55271bc20bef61213b463231337389f49fb1aecc4a81236a1313b613d3bcab6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency logRelease files / truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
194f1d6aed339e33e8be09abf58010bcbdc5ac53865c7c8df26278c73fafa4ce
|
|
BLAKE2b-256 checksum How to use checksums |
b30c1f94ec03ea5cb612678867787be09071f2b4be0c96ced1350bd9841783c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency logRelease files / truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d43d50ef733234eeb22f8bf51bde4e2b480377bf0e0e8f886830f82b72f6bbd7
|
|
BLAKE2b-256 checksum How to use checksums |
4466869553344040b1274ad67b873bb8e28a9641ef414b8a0e50937e4ac9871d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency logRelease files / truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3ea6d4b9fb8c8146f5680090efec1fc41bd73ece99afa2e818145b675b6eebd
|
|
BLAKE2b-256 checksum How to use checksums |
30b10b25f2dee0b6352ce80402e17cb66b45e0e257170781893a7a7617a31733
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency logRelease files / truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
00fe8d8516b1c615f19de89132fdb5fe46ac3517ba2ec1f8833f7db880baf43a
|
|
BLAKE2b-256 checksum How to use checksums |
225d880b99c369ac13495f64664b98f4f7cb3ebe0fb77e3758729e9750456c65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 28, 2026.
Transparency log