This project is a Gmail label classifier Eval Framework built using the Claude API and python
It tests LLM output/categorization against accuracy, consistency, and model-based grading.
- Accuracy — "is Claude's answer the RIGHT answer?"
- Consistency — "does Claude agree with itself across repeated calls?"
- Code-based grading — "is the predicted label even a valid category, checked with plain Python logic?"
- Model-based grading — "asks Claude to review a classification for reasonableness (Mode B grading)"
classify_email.pysends one email's text to Claude and returns a predicted labelrun_eval.pyruns each test email through the classifier and checks it four ways:- Accuracy — does the prediction match the expected label?
- Consistency — does Claude give the same answer across repeated calls?
- Code-based grading — is the predicted label one of the 6 valid categories (checked with plain Python, no API call)?
- Model-based grading — Claude reviews its own classification for reasonableness (only on failures)
- Results print to the terminal and export to
eval_results.jsonandconsistency_results.json
01-pure-python-evals
├── classify_email.py
├── test_data.py
├── run_eval.py
├── eval_results.json
├── consistency_results.json
├── workflow_screenshot.svg
├── .env
├── README.md
└── requirements.txt
- Python
- Anthropic Claude API(via the
anthropicPython SDK) - python-dotenv
- Clone the repo
pip install -r requirements.txt- Add your API key to a
.envfile:ANTHROPIC_API_KEY=your-key-here python run_eval.py
Latency:0.85 seconds
[PASS] expected: Bills & Utilities got: Bills & Utilities
Latency:0.67 seconds
[PASS] expected: Job Alerts got: Job Alerts
Latency:0.60 seconds
[PASS] expected: Shipping & Orders got: Shipping & Orders
Latency:0.73 seconds
[PASS] expected: Learning & Courses got: Learning & Courses
Latency:0.80 seconds
[PASS] expected: High Priority got: High Priority
Latency:0.58 seconds
[PASS] expected: Alerts & Newsletters got: Alerts & Newsletters
Latency:1.28 seconds
[FAIL] expected: High Priority got: Job Alerts
Valid
Latency:0.71 seconds
[PASS] expected: Bills & Utilities got: Bills & Utilities
Latency:0.54 seconds
[PASS] expected: Learning & Courses got: Learning & Courses
Latency:0.69 seconds
[PASS] expected: Shipping & Orders got: Shipping & Orders
Accuracy: 90.0%
Swati J