Prerequisites
Before installing Tweet Audit Tool, ensure you have the following:Python 3.12 or higher
Verify your Python installation:
The tool requires Python 3.12+ for modern type hints and language features.
X (Twitter) archive
Request and download your complete X archive:
- Go to X.com → More → Settings and Privacy → Your Account
- Click “Download an archive of your data”
- Wait for confirmation email (typically 24-48 hours)
- Download and extract the ZIP file
Gemini API key
Get a free API key from Google AI Studio:
- Visit Google AI Studio
- Sign in with your Google account
- Click “Create API Key”
- Copy your API key (you’ll need it for configuration)
Installation
Install dependencies
Choose your preferred package manager:The tool requires these core dependencies:
uv is recommended for faster dependency resolution and installation. It’s a modern Python package installer that’s significantly faster than pip.
google-genai>=1.63.0- Google Gemini AI clientpython-dotenv>=1.2.1- Environment variable managementpytest>=9.0.2- Testing frameworkruff>=0.15.1- Code linting and formatting
Environment configuration
Create a.env file in the project root with your configuration:
Criteria configuration
Define what makes a tweet “unaligned” with your values:Create config.json (optional)
Create a
config.json file in the project root:If you skip this step, the tool uses sensible defaults focused on professional content moderation.
Understand the criteria types
forbidden_words
forbidden_words
Exact word matches (case-insensitive). The AI flags tweets containing any of these words.Example:
- Flags: “Crypto is the future!” ✓
- Keeps: “Cryptocurrency adoption” ✗ (different word)
topics_to_exclude
topics_to_exclude
High-level content categories. The AI interprets these broadly and flags tweets matching these themes.Example:
tone_requirements
tone_requirements
Stylistic rules for communication tone. The AI checks if tweets violate these standards.Example:
additional_instructions
additional_instructions
Free-form guidance for the AI. Use this for nuanced instructions or context-specific rules.Example:
Default criteria
If you don’t createconfig.json, the tool uses these defaults (defined in src/config.py:51-64):
Prepare your Twitter archive
Place your extracted Twitter archive in the correct location:Copy tweets.json
Copy the
tweets.json file from your extracted X archive:The tool expects to find your tweets at
data/tweets/tweets.json by default. This path is configured in src/config.py:35.Verify setup
Before running analysis, verify everything is configured correctly:If all checks pass, you’re ready to start analyzing tweets!
Troubleshooting
ModuleNotFoundError: No module named 'google.genai'
ModuleNotFoundError: No module named 'google.genai'
Dependencies weren’t installed correctly. Try:
GEMINI_API_KEY is required
GEMINI_API_KEY is required
Your Ensure the line reads:
.env file is missing or doesn’t contain GEMINI_API_KEY. Verify:FileNotFoundError: data/tweets/tweets.json
FileNotFoundError: data/tweets/tweets.json
Your Twitter archive isn’t in the expected location. Check:Copy your archive to the correct location:
Python version error
Python version error
The tool requires Python 3.12+. Check your version:If you have multiple Python versions:
Next steps
Quick start
Now that you’re set up, run your first tweet analysis