|
| 1 | +--- |
| 2 | +title: TruthTracer | AI-Powered Misinformation Detection Platform |
| 3 | +description: A comprehensive misinformation detection platform that uses Perplexity's Sonar API to analyze claims, trace trust chains, and provide Socratic reasoning for fact verification |
| 4 | +sidebar_position: 25 |
| 5 | +keywords: [TruthTracer, misinformation detection, fact-checking, trust chain analysis, Socratic reasoning, Perplexity, Sonar API, NestJS, React] |
| 6 | +--- |
| 7 | + |
| 8 | +**TruthTracer** is a comprehensive misinformation detection platform that leverages Perplexity's Sonar API to provide multi-layered claim analysis. The platform combines fact-checking, trust chain tracing, and Socratic reasoning to deliver accurate, evidence-based verification results with confidence scores and detailed sourcing. |
| 9 | + |
| 10 | +### Demo |
| 11 | + |
| 12 | +<iframe |
| 13 | + className="w-full aspect-video rounded-xl" |
| 14 | + src="https://www.youtube.com/embed/twXeyK5ajyE" |
| 15 | + title="YouTube video player" |
| 16 | + frameBorder="0" |
| 17 | + allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" |
| 18 | + allowFullScreen |
| 19 | +></iframe> |
| 20 | + |
| 21 | +## Features |
| 22 | + |
| 23 | +* **Multi-method Analysis** combining fact-checking, trust chain analysis, and Socratic reasoning |
| 24 | +* **AI-Powered Verification** using Perplexity's Sonar, Sonar Deep Research, and Sonar Reasoning models |
| 25 | +* **Real-time Processing** with parallel execution of multiple analysis methods |
| 26 | +* **Evidence-based Results** providing sources, confidence scores, and detailed reasoning |
| 27 | +* **Clean Architecture** with NestJS backend and React frontend |
| 28 | +* **Production-Ready** with Docker deployment, comprehensive testing, and API documentation |
| 29 | +* **Configurable Confidence Scoring** with customizable weights and thresholds |
| 30 | + |
| 31 | +## Prerequisites |
| 32 | + |
| 33 | +* Node.js 18+ and npm |
| 34 | +* Perplexity API key (Sonar models access) |
| 35 | +* Docker (optional for deployment) |
| 36 | +* Git for repository cloning |
| 37 | + |
| 38 | +## Installation |
| 39 | + |
| 40 | +```bash |
| 41 | +# Clone the backend repository |
| 42 | +git clone https://github.com/anthony-okoye/truth-tracer-backend.git |
| 43 | +cd truth-tracer-backend |
| 44 | + |
| 45 | +# Install dependencies |
| 46 | +npm install |
| 47 | + |
| 48 | +# Clone the frontend repository |
| 49 | +git clone https://github.com/anthony-okoye/truth-tracer-front.git |
| 50 | +cd truth-tracer-front |
| 51 | + |
| 52 | +# Install frontend dependencies |
| 53 | +npm install |
| 54 | +``` |
| 55 | + |
| 56 | +## Configuration |
| 57 | + |
| 58 | +Create `.env` file in the backend directory: |
| 59 | +```ini |
| 60 | +# Required |
| 61 | +SONAR_API_KEY=your_perplexity_api_key |
| 62 | +SONAR_API_URL=https://api.perplexity.ai |
| 63 | + |
| 64 | +# Optional configuration |
| 65 | +SONAR_TIMEOUT=30000 |
| 66 | +SONAR_MAX_RETRIES=3 |
| 67 | +CONFIDENCE_WEIGHT_FACT_CHECK=0.35 |
| 68 | +CONFIDENCE_WEIGHT_TRUST_CHAIN=0.25 |
| 69 | +CONFIDENCE_WEIGHT_SOCRATIC=0.20 |
| 70 | +``` |
| 71 | + |
| 72 | +## Usage |
| 73 | + |
| 74 | +1. **Start Backend**: |
| 75 | +```bash |
| 76 | + cd truth-tracer-backend |
| 77 | + npm run start:dev |
| 78 | + ``` |
| 79 | + |
| 80 | +2. **Start Frontend**: |
| 81 | +```bash |
| 82 | + cd truth-tracer-front |
| 83 | + npm start |
| 84 | + ``` |
| 85 | + |
| 86 | +3. **Access Application**: Open http://localhost:3000 in your browser |
| 87 | + |
| 88 | +4. **Analyze Claims**: |
| 89 | + - Enter a claim in the text area |
| 90 | + - Click "Analyze Claim" to run fact-checking, trust chain analysis, and Socratic reasoning |
| 91 | + - View results with confidence scores, sources, and detailed explanations |
| 92 | + |
| 93 | +## Code Explanation |
| 94 | + |
| 95 | +* **Backend**: NestJS application with clean architecture following TypeScript best practices |
| 96 | +* **AI Integration**: Perplexity Sonar API with three specialized models - Sonar for fact-checking, Sonar Deep Research for trust chain analysis, and Sonar Reasoning for logical evaluation |
| 97 | +* **Parallel Processing**: Simultaneous execution of all three analysis methods for efficient claim verification |
| 98 | +* **Response Sanitization**: Custom JSON parsing and validation to handle various API response formats |
| 99 | +* **Confidence Scoring**: Weighted scoring system combining results from all three analysis methods |
| 100 | +* **Frontend**: React application with intuitive claim submission interface and detailed results visualization |
| 101 | +* **Testing**: Comprehensive test suite including unit tests, end-to-end tests, and claim analysis testing |
| 102 | + |
| 103 | +## How the Sonar API is Used |
| 104 | + |
| 105 | +TruthTracer leverages Perplexity's Sonar API through three distinct analysis approaches: |
| 106 | + |
| 107 | +```typescript |
| 108 | +// Parallel execution of multiple Sonar models |
| 109 | +const [factCheckResult, trustChainResult, socraticResult] = await Promise.all([ |
| 110 | + sonarClient.chat.completions.create({ |
| 111 | + model: "sonar", |
| 112 | + messages: [{ role: "user", content: factCheckPrompt }], |
| 113 | + max_tokens: 500 |
| 114 | + }), |
| 115 | + sonarClient.chat.completions.create({ |
| 116 | + model: "sonar-deep-research", |
| 117 | + messages: [{ role: "user", content: trustChainPrompt }], |
| 118 | + max_tokens: 2500 |
| 119 | + }), |
| 120 | + sonarClient.chat.completions.create({ |
| 121 | + model: "sonar-reasoning", |
| 122 | + messages: [{ role: "user", content: socraticPrompt }], |
| 123 | + max_tokens: 4000 |
| 124 | + }) |
| 125 | +]); |
| 126 | +``` |
| 127 | + |
| 128 | +## Links |
| 129 | + |
| 130 | +- [Live Demo](https://truthtracer.netlify.app/) |
| 131 | +- [Backend Repository](https://github.com/anthony-okoye/truth-tracer-backend) |
| 132 | +- [Frontend Repository](https://github.com/anthony-okoye/truth-tracer-front) |
0 commit comments