aiml

LLM Evals

DeepEval 4.3

Test LLM features with pytest and DeepEval, measure RAG and tool-call quality per stage, and gate prompt, model and dataset changes on regressions in CI.

What is LLM evaluation?

LLM evaluation checks an application's behavior against explicit requirements using test cases and graders. An evaluation case states an input and an expected requirement. A grader checks the observed output, and a report keeps failed and incomplete cases visible. Tool use, source support and answer usefulness need different checks; one passing score cannot represent all three.

Follow the tracker assistant through issue triage and documentation questions. Start with a fixed pytest suite, inspect stage-specific failures, then compare prompt or model changes. Dataset-split checks and release manifests keep comparisons tied to the cases and application inputs they describe.

What you'll learn

  • Build a pytest eval harness with a versioned dataset, deterministic checks, a calibrated LLM-as-judge metric and record/replay for CI.
  • Score an agent's tool calls, retrieval and grounded answers separately with DeepEval metrics, and name the stage that failed.
  • Write perturbation and prompt-injection tests, and find flips that a single pass rate hides.
  • Gate a prompt, model or dataset change on regressions in GitHub Actions, and refuse runs that can't be compared.
  • Check dataset splits for leakage and match recorded cases and stages to a local release manifest.

Lessons

  1. Build an eval harness with pytestRead

    Build a versioned pytest eval harness for an LLM triage function with structured-output checks, a calibrated DeepEval G-Eval judge, pass^k and offline replay.

    25 min readLabQuiz

  2. Measure RAG and tool-call qualityRead

    Evaluate a LangChain docs agent stage by stage with DeepEval, score its tool calls, retrieval and answer faithfulness, and report the first stage that fails.

    25 min readLabQuiz

  3. Write robustness tests for an LLM appRead

    Extend a pytest eval suite with meaning-preserving perturbations and prompt-injection cases, run it on Gemini and Gemma, and read per-perturbation pass counts.

    20 min readLabQuiz

  4. Gate releases on eval regressions in CIRead

    Gate prompt, model and dataset changes by comparing a pytest eval run with the main baseline, block new failures and run it in GitHub Actions without a model.

    22 min readLabQuiz

  5. Check evaluation datasets for leakageRead

    Keep related tracker issues in one split, review word overlap and copied prompt text, and detect changes after a held-out dataset is frozen.

    22 min readLabQuiz

  6. Bind an eval run to a release manifestRead

    Hash a tracker docs-assistant bundle, compare its settings with a recorded eval run, and reject changed files or missing evaluated cases.

    20 min readLabQuiz