Python client library for Cleanlab Trustworthy Language Model
Project description
Cleanlab Trustworthy Language Model (TLM) - Trust Scores for every LLM output
In one line of code, Cleanlab TLM adds real-time evaluation of every response in LLM, RAG, and Agent systems.
Setup
TLM requires an API key. Get one here for free.
export CLEANLAB_TLM_API_KEY=<YOUR_API_KEY_HERE>
Install the package:
pip install cleanlab-tlm
Usage
TLM automatically scores the trustworthiness of responses generated from your own LLM in real-time:
from cleanlab_tlm import TLM
tlm = TLM(options={"log": ["explanation"]})
tlm.get_trustworthiness_score(
prompt="What's the third month of the year alphabetically?",
response="August" # generated from any LLM model using the same prompt
)
This returns a dictionary with trustworthiness_score and optionally requested fields like explanation.
{
"trustworthiness_score": 0.02993446111679077,
"explanation": "Found alternate plausible response: December"
}
Alternatively, you generate responses and simultaneously score them with TLM:
tlm = TLM(options={"log": ["explanation"], "model": "gpt-4.1-mini"}) # GPT, Claude, etc.
tlm.prompt("What's the third month of the year alphabetically?")
This additionally returns a response.
{
"response": "March.",
"trustworthiness_score": 0.4590804375945598,
"explanation": "Found alternate plausible response: December"
}
Why TLM?
- Trustworthiness Scores: Every LLM response is scored via state-of-the-art uncertainty estimation, helping you reliably gauge the likelihood of hallucinated/incorrect responses.
- Higher accuracy: Rigorous benchmarks show TLM consistently produces more accurate scores than other hallucination detectors and responses than other LLMs.
- Scalable API: TLM is suitable for all enterprise applications where correct LLM responses are vital, including data extraction, tagging/labeling, Q&A (RAG), Agents, and more.
Documentation
Comprehensive documentation and tutorials can be found here.
License
cleanlab-tlm is distributed under the terms of the MIT license.
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 Distribution
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 cleanlab_tlm-1.1.39.tar.gz.
File metadata
- Download URL: cleanlab_tlm-1.1.39.tar.gz
- Upload date:
- Size: 105.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6352750a93632a36d8f19503f977ee5089ec9776be0c784835fdf3e03e69d2
|
|
| MD5 |
a0d52ce803661c24412f68b1af076411
|
|
| BLAKE2b-256 |
0906af923425da52e62c1127589461c416c36ea4346e3be6911f5fe0a591adf9
|
Provenance
The following attestation bundles were made for cleanlab_tlm-1.1.39.tar.gz:
Publisher:
release.yml on cleanlab/cleanlab-tlm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cleanlab_tlm-1.1.39.tar.gz -
Subject digest:
1f6352750a93632a36d8f19503f977ee5089ec9776be0c784835fdf3e03e69d2 - Sigstore transparency entry: 714037783
- Sigstore integration time:
-
Permalink:
cleanlab/cleanlab-tlm@ec933a8f1441789bf05e96dfee4fd272bab0c2c8 -
Branch / Tag:
refs/tags/v1.1.39 - Owner: https://github.com/cleanlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ec933a8f1441789bf05e96dfee4fd272bab0c2c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cleanlab_tlm-1.1.39-py3-none-any.whl.
File metadata
- Download URL: cleanlab_tlm-1.1.39-py3-none-any.whl
- Upload date:
- Size: 70.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82edeed3ab05edb860daa981ae6a7d8f0d8d7fd7027521f68987711398b168ea
|
|
| MD5 |
63a865ff5617a462edeb0973e1b93eda
|
|
| BLAKE2b-256 |
a6bcf7a7a50025fedb7e3c37185171488418118de7c2e07d4b907e381691db02
|
Provenance
The following attestation bundles were made for cleanlab_tlm-1.1.39-py3-none-any.whl:
Publisher:
release.yml on cleanlab/cleanlab-tlm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cleanlab_tlm-1.1.39-py3-none-any.whl -
Subject digest:
82edeed3ab05edb860daa981ae6a7d8f0d8d7fd7027521f68987711398b168ea - Sigstore transparency entry: 714037785
- Sigstore integration time:
-
Permalink:
cleanlab/cleanlab-tlm@ec933a8f1441789bf05e96dfee4fd272bab0c2c8 -
Branch / Tag:
refs/tags/v1.1.39 - Owner: https://github.com/cleanlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ec933a8f1441789bf05e96dfee4fd272bab0c2c8 -
Trigger Event:
push
-
Statement type: