Training project · 2026 · FastAPI/LLM

AI Triage Service

First-line triage for support requests: category, draft reply, confidence and escalation.

47 tests 5 req/min 4 categories
FastAPI · Pydantic 2 · SQLite
OpenAI-compatible API · Docker · Caddy
Demo mode · fallback · audit
AI Triage Service API response

INTERFACE RECONSTRUCTION · BASED ON THE RUNNING SERVICE

Problem

Support teams spend time sorting repetitive messages and writing similar replies. Full automation is risky: a wrong answer costs more than a slow one. The service has to be useful when the model works and safe when it does not.

What it does

  • Accepts a support message and classifies it as billing, support, complaint or other.
  • Writes a draft reply for a human agent.
  • Returns confidence and an explicit escalation flag.
  • Stores every request and result in SQLite for audit.
  • Limits each client to 5 requests per minute.
  • Runs in demo mode without an API key using a local knowledge base.

How it works

  1. Request validation: text up to 2,000 characters, client ID up to 128.
  2. Per-client rate limit: 5 requests per minute.
  3. LLM call through an OpenAI-compatible endpoint.
  4. JSON parsing and schema validation.
  5. Audit record in SQLite.
  6. If the model fails, a fallback response is returned instead of a 500.

Engineering notes

  • 47 tests, 4 categories, confidence, escalation.
  • Rate limiting and input limits are part of the contract.
  • Docker Compose with healthcheck and Caddy.
  • SQLite audit trail.
  • Demo mode works without a key.

What I would improve next

  • Human feedback loop: correct the category and reuse the correction.
  • CRM/helpdesk integration instead of a standalone endpoint.
  • PII redaction before sending text to the model.
  • Auth, per-tenant quotas and monitoring.
Interface reconstruction based on the running service. Not a live screenshot. The response card is a static representation of the JSON output.