Frameworks such as DeepEval package what your lesson 15 harness does by hand: test cases, metrics, thresholds and reports. Knowing both lets you judge what a framework adds, and what it hides.
Three DeepEval pieces matter here:
- LLMTestCase holds the input and the reply.
- Metrics score a test case. A custom
BaseMetriccan run any rule, such as your patterns. GEval asks a judge model to score the reply against a written criterion. - assert_test fails the pytest test when any metric scores below its threshold.
GEval needs a judge model. This runner has no internet, so judge.py provides a scripted stand-in: it plugs into DeepEval like a real model but scores with fixed rules, which it lists at the top of the file. With a real judge, the same code would call a model, cost money, and sometimes be wrong.
Your task
- Finish
PatternMetricand turn every case into a test, with GEval on the off-topic case. - Mark what each version of the harness does. On submit your suite runs against a correct bot and three faulty ones.