How davidlinjiahao/frank_analyzer works
Project Type and Purpose
• The project is a specialized analytic tool that uses multiple LLMs to process tweets, calculate a consensus prediction, and output structured results in CSV format.
• The README clearly indicates that the tool:
• Processes tweets using various models (e.g., Claude 3, GPT-4, Gemini Pro, etc.)
• Calculates a consensus prediction via majority voting
• Outputs and tracks progress in real time
• Utilizes error handling and asynchronous processing to manage API calls and retries
File Structure Analysis
• Top-Level Files and Directories:
• Python scripts (e.g., frank_classifier.py, frank_context.py, frank_evaluator.py, frank_extractor.py) which form the core modules for different processing phases.
• A “fixes” directory that contains Python scripts and text files to handle error corrections or data fixes.
• Several CSV files for storing results (e.g., results.csv, classified_results.csv, evaluated_results.csv) which indicate different stages in processing.
• A test directory with tests for components (test_grok.py, test_perplexity.py, verify_pattern.py) suggesting unit tests for key functionalities.
• Node-related files (package.json, package-lock.json) and agent.js, which might indicate some ancillary automated tasks or integration tests via JavaScript.
• Architectural Patterns:
• The modular division (extractor, classifier, evaluator, context) hints at a pipeline architecture where data flows sequentially through distinct processing stages.
• The “fixes” directory demonstrates an extension point where error correction is handled separately from the core processing.
Critical Components
a. Input and Data Acquisition:
• Tweets are the primary input (likely coming from “frank_tweets.json” and possibly integrated with twitter-scraper-finetune).
• Environment setup is crucial (via .env for API keys).
b. Core Processing Pipeline:
• Frank Extractor: Module to ingest tweets.
• Frank Classifier: Module to send tweets to multiple LLMs (Claude 3, GPT-4, etc.), get predictions, and capture reasoning.
• Frank Evaluator: Module for calculating consensus predictions, possibly using majority voting.
• Frank Context: Module to manage tweet contexts, perhaps to retain additional metadata.
c. Error Handling and Fixes:
• “fixes” folder components that apply corrective scripts on processed data (e.g., fix error contexts, reprocess tweets, fix token issues).
d. Data Output:
• CSV files as final output.
• Real-time progress tracking (shown on the terminal perhaps).
e. Supporting Components:
• Asynchronous processing mechanics – ensure to denote if and where the asynchronous operations occur.
• External API integrations for the multiple LLMs:
• OpenAI (GPT-4), Anthropic (Claude 3), Google (for DeepSeek), Perplexity API, Grok API.
• Testing modules ensuring the reliability of individual processing steps.
Final Recommendations
• Distinguish between internal modules (Python scripts like frank_classifier.py, frank_context.py, etc.) and external dependencies (LLM APIs using keys in .env).