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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fd81f80e05f5c0eb6f2e563df52c7dec253fa8acb3913401dbf836af47b8124
|
|
| MD5 |
eafa89ab41e411b0f09f64386ebcaf16
|
|
| BLAKE2b-256 |
4bacc1b9ed248d13444c60a5840f0212699e371bfd9a6e1117964ca65f603fd4
|
Provenance
The following attestation bundles were made for truthlens-0.6.0.tar.gz:
Publisher:
pypi-publish.yml on yablokolabs/truthlens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0.tar.gz -
Subject digest:
3fd81f80e05f5c0eb6f2e563df52c7dec253fa8acb3913401dbf836af47b8124 - Sigstore transparency entry: 1190662700
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94e58a64ea78fc5f81d18d34e9403d6e4893c90f8ed1a362c9d90fe04b5e1181
|
|
| MD5 |
3e2f71923eec1c68ea7ebf0cee8d4a96
|
|
| BLAKE2b-256 |
55271bc20bef61213b463231337389f49fb1aecc4a81236a1313b613d3bcab6d
|
Provenance
The following attestation bundles were made for truthlens-0.6.0-cp313-cp313-win_amd64.whl:
Publisher:
pypi-publish.yml on yablokolabs/truthlens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0-cp313-cp313-win_amd64.whl -
Subject digest:
94e58a64ea78fc5f81d18d34e9403d6e4893c90f8ed1a362c9d90fe04b5e1181 - Sigstore transparency entry: 1190662716
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
194f1d6aed339e33e8be09abf58010bcbdc5ac53865c7c8df26278c73fafa4ce
|
|
| MD5 |
a141848230a67683b8fff62ae6982696
|
|
| BLAKE2b-256 |
b30c1f94ec03ea5cb612678867787be09071f2b4be0c96ced1350bd9841783c1
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
194f1d6aed339e33e8be09abf58010bcbdc5ac53865c7c8df26278c73fafa4ce - Sigstore transparency entry: 1190662718
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d43d50ef733234eeb22f8bf51bde4e2b480377bf0e0e8f886830f82b72f6bbd7
|
|
| MD5 |
8dedeb6a0d1092f3e05de57585e61540
|
|
| BLAKE2b-256 |
4466869553344040b1274ad67b873bb8e28a9641ef414b8a0e50937e4ac9871d
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
d43d50ef733234eeb22f8bf51bde4e2b480377bf0e0e8f886830f82b72f6bbd7 - Sigstore transparency entry: 1190662710
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3ea6d4b9fb8c8146f5680090efec1fc41bd73ece99afa2e818145b675b6eebd
|
|
| MD5 |
733268b9bf7df3614f181fe552dbf92d
|
|
| BLAKE2b-256 |
30b10b25f2dee0b6352ce80402e17cb66b45e0e257170781893a7a7617a31733
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
c3ea6d4b9fb8c8146f5680090efec1fc41bd73ece99afa2e818145b675b6eebd - Sigstore transparency entry: 1190662713
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00fe8d8516b1c615f19de89132fdb5fe46ac3517ba2ec1f8833f7db880baf43a
|
|
| MD5 |
28f89851ccae45164655a5957e8c9e52
|
|
| BLAKE2b-256 |
225d880b99c369ac13495f64664b98f4f7cb3ebe0fb77e3758729e9750456c65
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truthlens-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
00fe8d8516b1c615f19de89132fdb5fe46ac3517ba2ec1f8833f7db880baf43a - Sigstore transparency entry: 1190662705
- Sigstore integration time:
-
Permalink:
yablokolabs/truthlens@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/yablokolabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@b6053850b6c359648b449c465062e5cf0cfdd9e0 -
Trigger Event:
push
-
Statement type: