llama-index-truthvouch
LlamaIndex integration for the TruthVouch Trust API. Add hallucination detection and content verification to any LlamaIndex RAG pipeline in minutes.
Installation
pip install llama-index-truthvouch
Quickstart
import os
os.environ["TRUTHVOUCH_API_KEY"] = "your-api-key"
from truthvouch_llamaindex import TruthVouchResponseEvaluator
evaluator = TruthVouchResponseEvaluator(threshold=0.8)
result = await evaluator.evaluate("The Eiffel Tower is in Paris, France.")
print(result.passing) # True
print(result.score) # e.g. 0.96
print(result.feedback) # human-readable explanation
Components
TrustApiClient
Low-level async/sync client for the Trust API verify endpoint.
from truthvouch_llamaindex import TrustApiClient
client = TrustApiClient(api_key="your-api-key")
result = client.verify_sync("The Eiffel Tower is in Paris.", mode="standard")
print(result.trust_score) # 0.97
TruthVouchNodePostprocessor
Filters retrieved nodes by trust score before they reach the LLM.
from llama_index.core import VectorStoreIndex
from truthvouch_llamaindex import TruthVouchNodePostprocessor
postprocessor = TruthVouchNodePostprocessor(threshold=0.75)
query_engine = index.as_query_engine(node_postprocessors=[postprocessor])
response = query_engine.query("What is the capital of France?")
TruthVouchResponseEvaluator
Evaluate a RAG response string for factual accuracy.
from truthvouch_llamaindex import TruthVouchResponseEvaluator
evaluator = TruthVouchResponseEvaluator(threshold=0.8)
result = await evaluator.evaluate("Some response text")
if not result.passing:
print("Hallucination risk:", result.feedback)
TruthVouchQueryEngine
Wrapper query engine that auto-verifies every response.
from truthvouch_llamaindex import TruthVouchQueryEngine
engine = TruthVouchQueryEngine(inner_query_engine=base_engine, threshold=0.8)
response = engine.query("Tell me about the Eiffel Tower.")
print(response.metadata["trust_score"])
Configuration
| Parameter | Env var | Default |
|---|---|---|
api_key |
TRUTHVOUCH_API_KEY |
(required) |
base_url |
— | http://localhost:5004/api/v1/trust |
threshold |
— | 0.8 |
mode |
— | spot_check |
License
Apache-2.0
Metadata
Release files for llama-index-truthvouch 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| llama_index_truthvouch-1.0.0.tar.gz | 15.7 kB | Without provenance | Details for llama_index_truthvouch-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_truthvouch-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_truthvouch-1.0.0-py3-none-any.whl |
Total release size: 30.1 kB
Release files / llama_index_truthvouch-1.0.0.tar.gz
| Download URL | llama_index_truthvouch-1.0.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b276c69bd2001c69aefa37b49ad86fcf6efb82536bc1dedfc6f9a62ea24ab95
|
|
BLAKE2b-256 checksum How to use checksums |
9f063cee2d8f0467ba55ca91bc84ac2cec2c788e8bab6375637f8393d723ab32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / llama_index_truthvouch-1.0.0-py3-none-any.whl
| Download URL | llama_index_truthvouch-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5c44800177747342bcdbd1b17f1a7fffd2b274767fbe36b4cba87a25daf8fcf
|
|
BLAKE2b-256 checksum How to use checksums |
76904b886c3b53f832e57d030832a8700b99c44b5f807c86cb2edea076d3e7cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for llama-index-truthvouch 1.0.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.