Fact Checker CLI
A command-line tool that identifies false or misleading claims in articles or statements using Perplexity’s Sonar API for web research.Features
- Analyze claims or entire articles for factual accuracy
- Identify false, misleading, or unverifiable claims
- Provide explanations and corrections for inaccurate information
- Output results in human-readable format or structured JSON
- Cite reliable sources for fact-checking assessments
- Leverages Perplexity’s structured outputs for reliable JSON parsing (for Tier 3+ users)
Installation
1. Install required dependencies
2. Make the script executable
API Key Setup
The tool requires a Perplexity API key to function. You can provide it in one of these ways:1. As a command-line argument
2. As an environment variable
3. In a file
Create a file namedpplx_api_key
or .pplx_api_key
in the same directory as the script:
Quick Start
Run the following command immediately after setup:Usage
Check a claim
Check an article from a file
Check an article from a URL
Specify a different model
Output results as JSON
Use a custom prompt file
Enable structured outputs (for Tier 3+ users)
Structured output is disabled by default. To enable it, pass the--structured-output
flag:
Get help
Output Format
The tool provides output including:- Overall Rating: MOSTLY_TRUE, MIXED, or MOSTLY_FALSE
- Summary: A brief overview of the fact-checking findings
- Claims Analysis: A list of specific claims with individual ratings:
- TRUE: Factually accurate and supported by evidence
- FALSE: Contradicted by evidence
- MISLEADING: Contains some truth but could lead to incorrect conclusions
- UNVERIFIABLE: Cannot be conclusively verified with available information
- Explanations: Detailed reasoning for each claim
- Sources: Citations and URLs used for verification
Example
Run the following command:Limitations
- The accuracy of fact-checking depends on the quality of information available through the Perplexity Sonar API.
- Like all language models, the underlying AI may have limitations in certain specialized domains.
- The structured outputs feature requires a Tier 3 or higher Perplexity API account.
- The tool does not replace professional fact-checking services for highly sensitive or complex content.