In this article, you will learn how to build a lightweight, reusable LLM evaluation harness in Python that combines exact-match scoring, an LLM-as-a-judge, and versioned regression tracking to catch prompt regressions.
Topics we will cover include:
How to score deterministic tasks like ticket routing with a normalized exact-match scorer.
How to grade open-ended responses with a rubric-based LLM-as-a-judge that returns structured Pydantic output.
How to log each prompt version’s results and compare runs case by case to detect regressions that an overall pass rate can hide.
Introduction
When teams need to evaluate prompts passed to LLMs, they typically do so “by eye”: they run several examples in a playground environment while tweaking a system instruction, pick the one that looks better, and ship it.…