Adam BlansettSenior Full-Stack & AI Engineer
Developer Tools & StartersActive Open-Source Release v0.1.0 (MIT)

LLM Eval Toolkit

Deterministic, offline contract evaluation and baseline regression detection CLI for AI application outputs.

Engineering RoleCreator & Lead Maintainer

01. Problem & Context

Teams shipping LLM features face silent JSON schema drift, omitted required keys, wrong field types, leaked prohibited strings, and prompt regressions—while calling live LLM APIs inside CI pipelines is slow, expensive, non-deterministic, and exposes test fixtures.

02. Engineering Solution

Built `llm-eval-toolkit` (`llm-eval`), a 100% offline, deterministic TypeScript evaluation CLI and programmatic API that decouples contract verification from live model calls. Validates datasets with Zod, evaluates saved `.json`/`.jsonl` fixtures across 10 built-in evaluators plus custom plugins (`-e`), compares runs against saved regression baselines, and exports multi-format CI reports.

03. System Architecture

A Zod-validated dataset and fixture loader (supporting versioned objects, key-value maps, arrays, and streaming `.jsonl`) dispatches cases through 10 deterministic evaluators and custom modules (`defineConfig` / `-e`), tracks pass/fail regressions against saved baseline snapshots, and emits Terminal, JSON, Markdown, JUnit XML, and GitHub Actions annotations.

Core Architectural Components

10 Built-In Contract Evaluators & Custom Plugin API

Provides `exact_match` (with colored unified diffs), `required_content`, `prohibited_content`, `json`/`json_valid` (with automatic Markdown code-fence stripping), `json_schema` (Ajv), `required_fields`, `field_types`, `numeric_range`, `regex_match`, and `similarity` (Levenshtein & token Jaccard), plus dynamic custom evaluators (`-e`).

Versioned Regression Baselines (`baseline create/compare/inspect`)

Stores versioned baseline snapshots to detect newly failing cases and policy regressions across prompt or model updates, supporting `-u` / `--update-baseline` for controlled updates.

Dual JSON & Streaming JSONL Input Pipeline

Supports `.json` and `.jsonl` (with `_meta` headers) across four fixture shapes, classifying missing outputs as structured `ERROR` (`missingOutput: true`) diagnostics rather than silent passes.

CI Reporters, Filtering & Path-Safe Execution

Outputs Terminal diffs, JSON, GFM Markdown, JUnit XML, and GitHub Actions `::error` step summaries with `--watch`, `--tag`, `--grep`, `dataset validate`, atomic file writes, path-traversal protection, and exit codes `0`–`4`.

04. Notable Engineering Decisions

Decoupling Contract Evaluation from Live Model Execution

Running live model inference in every PR check makes CI flaky and slow. Evaluating saved output fixtures deterministically offline catches schema and policy regressions in milliseconds with zero API keys.

Automatic Markdown Fence Stripping & Structured Missing-Output Errors

Models frequently wrap JSON in ```json fences, while missing fixture IDs can mask broken pipelines; stripping fences cleanly and surfacing `missingOutput: true` prevents false negatives and silent omissions.

Strict Zod Dataset Contracts & Safe Atomic Baseline Writes

Actionable Zod errors pinpoint malformed case IDs immediately, while path-traversal checks and atomic writes keep baseline updates safe in automated pipelines.

05. Engineering Challenges & Solutions

Challenge: Validating subtle structural regressions when teams iterate on prompts or swap model providers.

Engineering Solution: Paired deep structural `exact_match` diffs and Ajv JSON Schema assertions with versioned baseline comparisons (`llm-eval baseline compare`) to catch any newly failing case.

Challenge: Accommodating large evaluation datasets and varied CI output formats without external dependencies.

Engineering Solution: Supported streaming `.jsonl` datasets/fixtures alongside built-in Terminal, JSON, Markdown, JUnit XML, and GitHub Actions reporters.

06. Implementation Highlights

  • 100% offline deterministic evaluation engine (`llm-eval`) requiring zero API keys or network access
  • 10 built-in evaluators (`exact_match`, `json_schema` via Ajv, `required_fields`, `field_types`, `numeric_range`, `regex_match`, `similarity`, etc.) + custom `-e` plugins
  • Zod-validated `.json` and streaming `.jsonl` datasets & 4 output fixture formats with Markdown code-fence extraction
  • Versioned baseline lifecycle (`baseline create`, `compare`, `inspect`, `--update-baseline`) for prompt/model regression gating
  • Terminal, JSON, Markdown, JUnit XML, and GitHub Actions reporters with `--watch`, `--tag`, `--grep`, and exit codes `0`–`4`
  • Verified across 23 Vitest test files (122 passing tests) and Node 18.x/20.x/22.x GitHub Actions CI