An LLM-powered support-ticket classifier paired with a zero-dependency mock API that serves and validates tickets. The classifier pulls a random ticket, asks an LLM (served via OpenRouter) to label it with one of the ticket types the API advertises, then validates that label back against the API.
┌──────────────┐ GET /messages/random ┌──────────────────┐
│ │ ─────────────────────────▶│ │
│ classifier │ GET /messages/types │ mock API │
│ (LLM call) │ ─────────────────────────▶│ (stdlib only) │
│ │ POST /messages/{id}/ │ │
│ │ ────────── validate ──────▶│ │
└──────────────┘ └──────────────────┘
| Path | Description |
|---|---|
api/app.py |
Mock HTTP API (Python standard library, no deps). |
api/messages.json |
Seed dataset of SaaS support tickets across 5 types. |
api/tests.py |
Tests for the API. |
api/README.md |
API endpoint reference. |
classification/classifier.py |
Fetches a ticket, classifies it via an LLM, validates it. |
- Python 3.10+
- An OpenRouter API key
python3 -m venv .venv
source .venv/bin/activate
pip install requests openai python-dotenvCreate classification/.env with your key (this file is git-ignored):
API_KEY=sk-or-...Start the API in one terminal:
cd api
python3 app.py # listens on http://localhost:5555Run the classifier in another:
cd classification
python3 classifier.pyIt logs the fetched ticket, the LLM's classification, and the API's validation verdict (including the expected type when the guess is wrong).
See api/README.md for the full reference. In short:
GET /messages— all messages (id,type)GET /messages/types— distinct ticket typesGET /messages/random— one random full messagePOST /messages/{id}/validate— check a type guess; returns{"valid": bool, ...}