Skip to main content

Documentation 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.

Halgorithem includes an interactive terminal UI built with Rich that walks you through configuring and running a full verification session from the command line — no Python scripting needed. It covers every step: providing an API key, choosing source documents, setting parameters, entering a prompt, and reviewing results.

Starting the TUI

python tui.py
The terminal clears and displays the Halgorithem header. From there, the TUI guides you through each configuration step.
The TUI requires an OpenAI API key to generate the AI response. If the OPENAI_API_KEY environment variable is already set, the TUI detects it and skips the prompt. Otherwise, you are asked to enter it at startup. The key is masked as you type.

Interactive walkthrough

1

API key

The TUI checks for an existing OPENAI_API_KEY environment variable. If found, it displays the first four characters and continues. If not, you are prompted to enter your key. Leaving the field empty exits the program.
2

Choose a source mode

Select how you want to provide truth documents:
  • urls — enter one or more web page URLs
  • files — enter one or more local file paths
  • both — enter both URLs and file paths
The default is urls.
3

Enter URLs and/or file paths

Depending on the source mode you chose, you are prompted to enter URLs and/or file paths as comma-separated lists. The TUI confirms how many sources were queued. If no sources are provided, the program exits.
4

Configure settings

Three parameters are configurable with sensible defaults:
  • Verification threshold — minimum cosine similarity score to count as supported (default 0.30, range 0.01.0)
  • Sentences per chunk — how many sentences to group into each comparison chunk (default 2)
  • Sentence overlap — how many sentences to carry over between consecutive chunks (default 1)
Press Enter to accept a default without typing a value.
5

Enter your prompt

Type the question or instruction you want the AI to answer. The TUI passes this to Engine.generate() along with your source documents as factual grounding.
6

View results

The TUI runs three steps with a spinner — scraping sources, generating the AI response, and verifying claims — then clears the screen and displays the full results:
  • AI Output — the raw text generated by the model
  • Sources — the URLs and file paths used as truth documents
  • Run Config — the threshold, chunk size, overlap, and source count used
  • Verification Summary — a table showing supported, weak, contradiction, and hallucination counts out of total claims
  • Issues — a panel for each flagged claim showing its status, score, reason, unsupported terms, and the closest matching source chunk

Results display

The verification summary table shows counts for each status:
StatusMeaning
SupportedScore ≥ 0.65 — strong semantic match to source
Weak supportScore ≥ threshold — partial match
ContradictionsNumber mismatch or negation detected in matching chunk
HallucinationsScore below threshold — no supporting source found
Each flagged claim is displayed in a bordered panel with the claim text, similarity score, reason (for contradictions), any unsupported proper nouns or numbers, and the closest matching source chunk and its origin.
At the end of the session, the TUI asks “Show supported claims too?” before exiting. Answering yes prints all supported and weak-support claims with their unsupported terms, which is useful for auditing the full verification run, not just the failures.

Build docs developers (and LLMs) love