Skip to content

Commit 3996bf1

Browse files
committed
fix readmet
1 parent db3e07d commit 3996bf1

File tree

1 file changed

+83
-49
lines changed

1 file changed

+83
-49
lines changed

fact_checker_cli/README.md

Lines changed: 83 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,94 +13,126 @@ A command-line tool that identifies false or misleading claims in articles or st
1313

1414
## Installation
1515

16-
1. Install required dependencies:
16+
### 1. Install required dependencies
1717

18-
```bash
19-
pip install requests pydantic
18+
```bash
19+
pip install requests pydantic
20+
```
2021

21-
2. Make the script executable:
22+
### 2. Make the script executable
2223

24+
```bash
2325
chmod +x fact_checker.py
26+
```
2427

28+
## API Key Setup
2529

30+
The tool requires a Perplexity API key to function. You can provide it in one of these ways:
2631

27-
API Key Setup
32+
### 1. As a command-line argument
2833

29-
The tool requires a Perplexity API key to function. You can provide it in one of these ways:
30-
1. As a command-line argument:
31-
--api-key YOUR_API_KEY
32-
2. As an environment variable:
34+
```bash
35+
./fact_checker.py --api-key YOUR_API_KEY
36+
```
37+
38+
### 2. As an environment variable
39+
40+
```bash
3341
export PPLX_API_KEY=YOUR_API_KEY
34-
3. In a file named pplx_api_key or .pplx_api_key in the same directory as the script:
42+
```
3543

36-
# Create a file to store your API key
37-
echo "YOUR_API_KEY" > .pplx_api_key
38-
# Make sure to protect your API key
39-
chmod 600 .pplx_api_key
44+
### 3. In a file
4045

46+
Create a file named `pplx_api_key` or `.pplx_api_key` in the same directory as the script:
4147

48+
```bash
49+
echo "YOUR_API_KEY" > .pplx_api_key
50+
chmod 600 .pplx_api_key
51+
```
4252

43-
Note: If youre using the structured outputs feature, youll need a Perplexity API account with Tier 3 or higher access level.
53+
**Note:** If you're using the structured outputs feature, you'll need a Perplexity API account with Tier 3 or higher access level.
4454

45-
Quick Start
55+
## Quick Start
4656

47-
Here’s a command you can copy and run immediately after setup:
57+
Run the following command immediately after setup:
4858

59+
```bash
4960
./fact_checker.py -t "The Earth is flat and NASA is hiding the truth."
61+
```
5062

51-
This will analyze the claim, research it using Perplexity’s Sonar API, and return a detailed fact check with ratings, explanations, and sources.
52-
53-
Usage
63+
This will analyze the claim, research it using Perplexity's Sonar API, and return a detailed fact check with ratings, explanations, and sources.
5464

55-
Basic Usage
65+
## Usage
5666

57-
Check a claim:
67+
### Check a claim
5868

69+
```bash
5970
./fact_checker.py --text "The Earth is flat and NASA is hiding the truth."
71+
```
6072

61-
Check an Article from a File
73+
### Check an article from a file
6274

75+
```bash
6376
./fact_checker.py --file article.txt
77+
```
6478

65-
Specify a Different Model
79+
### Specify a different model
6680

81+
```bash
6782
./fact_checker.py --text "Global temperatures have decreased over the past century." --model "sonar-pro"
83+
```
6884

69-
Output Results as JSON
85+
### Output results as JSON
7086

87+
```bash
7188
./fact_checker.py --text "Mars has a breathable atmosphere." --json
89+
```
7290

73-
Use a Custom Prompt File
91+
### Use a custom prompt file
7492

93+
```bash
7594
./fact_checker.py --text "The first human heart transplant was performed in the United States." --prompt-file custom_prompt.md
95+
```
7696

77-
Enable Structured Outputs (for Tier 3+ Users)
97+
### Enable structured outputs (for Tier 3+ users)
7898

79-
Structured output is disabled by default. To enable structured outputs (for reliable JSON parsing), pass the --structured-output flag:
99+
Structured output is disabled by default. To enable it, pass the `--structured-output` flag:
80100

101+
```bash
81102
./fact_checker.py --text "Vaccines cause autism." --structured-output
103+
```
82104

83-
Get Help
105+
### Get help
84106

107+
```bash
85108
./fact_checker.py --help
109+
```
86110

87-
Output Format
111+
## Output Format
88112

89113
The tool provides output including:
90-
• Overall rating: MOSTLY_TRUE, MIXED, or MOSTLY_FALSE
91-
• Summary: A brief overview of the fact-checking findings
92-
• Claims Analysis: A list of specific claims with individual ratings:
93-
• TRUE: Factually accurate and supported by evidence
94-
• FALSE: Contradicted by evidence
95-
• MISLEADING: Contains some truth but presented in a way that could lead to incorrect conclusions
96-
• UNVERIFIABLE: Cannot be conclusively verified with available information
97-
• Explanations: Detailed reasoning for each claim
98-
• Sources: Citations and URLs used for verification
99114

100-
Example
115+
- **Overall Rating**: MOSTLY_TRUE, MIXED, or MOSTLY_FALSE
116+
- **Summary**: A brief overview of the fact-checking findings
117+
- **Claims Analysis**: A list of specific claims with individual ratings:
118+
- TRUE: Factually accurate and supported by evidence
119+
- FALSE: Contradicted by evidence
120+
- MISLEADING: Contains some truth but could lead to incorrect conclusions
121+
- UNVERIFIABLE: Cannot be conclusively verified with available information
122+
- **Explanations**: Detailed reasoning for each claim
123+
- **Sources**: Citations and URLs used for verification
124+
125+
## Example
101126

102-
$ ./fact_checker.py -t "The Great Wall of China is visible from the moon."
127+
Run the following command:
103128

129+
```bash
130+
./fact_checker.py -t "The Great Wall of China is visible from the moon."
131+
```
132+
133+
Example output:
134+
135+
```
104136
Fact checking in progress...
105137
106138
🔴 OVERALL RATING: MOSTLY_FALSE
@@ -110,16 +142,18 @@ The claim that the Great Wall of China is visible from the moon is false. This i
110142
111143
🔍 CLAIMS ANALYSIS:
112144
113-
Claim 1: ❌ FALSE
114-
Statement: "The Great Wall of China is visible from the moon."
115-
Explanation: The Great Wall of China is not visible from the moon with the naked eye. NASA astronauts have confirmed this, including Neil Armstrong who stated he could not see the Wall from lunar orbit. The Wall is too narrow and is similar in color to its surroundings when viewed from such a distance.
145+
Claim 1: ❌ FALSE
146+
Statement: "The Great Wall of China is visible from the moon."
147+
Explanation: The Great Wall of China is not visible from the moon with the naked eye. NASA astronauts have confirmed this, including Neil Armstrong who stated he could not see the Wall from lunar orbit. The Wall is too narrow and is similar in color to its surroundings when viewed from such a distance.
116148
Sources:
117149
- NASA.gov
118150
- Scientific American
119151
- National Geographic
152+
```
153+
154+
## Limitations
120155

121-
Limitations
122-
• The accuracy of fact-checking depends on the quality of information available through the Perplexity Sonar API
123-
• Like all language models, the underlying AI may have limitations in certain specialized domains
124-
• The structured outputs feature requires a Tier 3 or higher Perplexity API account
125-
• The tool does not replace professional fact-checking services for highly sensitive or complex content
156+
- The accuracy of fact-checking depends on the quality of information available through the Perplexity Sonar API.
157+
- Like all language models, the underlying AI may have limitations in certain specialized domains.
158+
- The structured outputs feature requires a Tier 3 or higher Perplexity API account.
159+
- The tool does not replace professional fact-checking services for highly sensitive or complex content.

0 commit comments

Comments
 (0)