The Paper Polish System now includes a built-in verify command that validates your Gemini API configuration before running the paper polishing workflow. This helps identify configuration issues early and provides clear diagnostic information.
# Verify with default config.json
python main.py verify
# Verify with custom config file
python main.py verify --config path/to/config.jsonpython main.py verify --helpThe verify command performs the following checks:
- Configuration File: Verifies the config file exists and is readable
- API Key: Checks that an API key is configured and not using placeholder text
- API Connection: Attempts a test API call to Gemini
- Model Availability: Confirms the configured model is available
- Response: Validates that the API returns a proper response
╭─────────────────────╮
│ 🔍 API Verification │
╰─────────────────────╯
📂 Loading configuration...
🔐 Checking API key...
✓ API key found (length: 39 chars)
🔄 Testing API connection...
✓ API connection successful
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Key ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ Provider │ gemini │
│ Model │ gemini-1.5-pro │
│ API Key Status │ ✓ Valid │
│ Connection │ ✓ Working │
│ Test Response │ API connection works! │
└─────────────────────┴───────────────────────┘
✨ All checks passed! Your API is ready to use.
╭─────────────────────╮
│ 🔍 API Verification │
╰─────────────────────╯
📂 Loading configuration...
🔐 Checking API key...
❌ API key not configured
💡 Please add your Gemini API key to config.json
❌ Verification failed: 404 Model 'gemini-1.5-pro' not found
Troubleshooting tips:
1. Verify your API key is correct
2. Check internet connection
3. Ensure the API key has appropriate permissions
4. Visit: https://aistudio.google.com/app/apikey to check/regenerate key
- Edit
config.jsonand replace<YOUR_GEMINI_API_KEY_HERE>with your actual API key - Get a free API key from: https://aistudio.google.com/app/apikey
- Ensure your API key is valid and has access to the requested model
- Check available models at: https://aistudio.google.com/app/apikey
- Common valid models:
gemini-1.5-pro- Recommended for academic papersgemini-1.5-flash- Faster, lower costgemini-2.0-pro- Latest features (if available)
- Check your internet connection
- Verify the API key has proper permissions
- Check if Google's Gemini API service is operational
- Try increasing
timeout_secondsin config.json
- The test prompt may be getting filtered by safety settings
- This is usually temporary; try again after a moment
- Check your API quota hasn't been exceeded
Before running the paper polishing workflow:
# 1. Initialize config (creates template)
python main.py init
# 2. Add your API key to config.json
# 3. Verify the setup works
python main.py verify
# 4. If verification passes, you're ready to polish papers
python main.py polish your_paper.texThe verify command reads from your config.json:
{
"api": {
"provider": "gemini",
"model": "gemini-1.5-pro",
"api_key": "<YOUR_GEMINI_API_KEY_HERE>",
"temperature": 0.7,
"max_tokens": 4096,
"timeout_seconds": 120
}
}The verify command (and all API calls) use the following safety settings:
- HARM_CATEGORY_SEXUALLY_EXPLICIT: BLOCK_NONE
- HARM_CATEGORY_DANGEROUS_CONTENT: BLOCK_NONE
- HARM_CATEGORY_HARASSMENT: BLOCK_NONE
- HARM_CATEGORY_HATE_SPEECH: BLOCK_NONE
This ensures academic content is not inappropriately filtered.
The verify command uses this test prompt:
"Say 'API connection successful!' in exactly 5 words."
This simple test validates that the API can receive and respond to prompts correctly.
0: All checks passed, API is ready to use1: Verification failed (see error messages for details)
You can add verification to automated scripts:
#!/bin/bash
# Verify API before running analysis
python main.py verify || exit 1
# If we get here, API is working
python main.py polish input.tex --output-dir resultsTo modify what the verify command checks or how it tests the API, edit the verify() function in main.py.
- README.md - Main documentation
- QUICKSTART.md - Quick start guide
- API_QUICK_REFERENCE.md - API configuration reference
- config.json - Configuration template