This guide covers using Halgorithem directly in your Python code. You can work at two levels: the low-levelDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TangibleResearch/Halgorithem/llms.txt
Use this file to discover all available pages before exploring further.
Halgorithm class, which handles chunking and comparison without any LLM calls, or the higher-level Engine class, which orchestrates scraping, generation, and verification end-to-end. Both expose the same underlying claim-checking logic.
Choosing an approach
- Halgorithm class
- Engine class
Use
Halgorithm when you already have an AI-generated text and want to check it against a set of source documents — no LLM is involved.load_files() returns a list of dicts with file_id, file_path, and text keys. Pass that list directly to compare_to_docs().print_report() writes a formatted summary to stdout, including confidence score and details on every flagged claim.Top-level convenience functions
engine.py also exports three module-level functions that share a single internal Engine instance. You can import them directly without instantiating a class:
urls, truth_file_paths, or both. At least one source must be provided, or a ValueError is raised.
Interpreting results
compare_to_docs() returns a list of claim dicts. Each dict contains:
status— one ofSUPPORTED,WEAK_SUPPORT,CONTRADICTION, orHALLUCINATIONclaim— the sentence extracted from the AI outputscore— cosine similarity score between the claim and the best matching chunkchunk_text— the source chunk that best matchedunsupported_terms— proper nouns or numbers in the claim not found in any sourcereason— set onCONTRADICTIONclaims (e.g."Number mismatch","Negation mismatch")
score >= 0.65 is SUPPORTED, score >= threshold (default 0.30) is WEAK_SUPPORT, and anything below is HALLUCINATION.