Skip to course content
Free generative AI app course

Generative AI Application Development with Python

Module 11 Activity

Scenario

Build the suite that will actually run - the one that needs no key.

What you build

An offline test suite with an injected model, scripted fakes driving the hard paths, structural assertions and a golden contract.

Steps

  1. Refactor so every function that calls a model takes it as a parameter.
  2. Use scripted fake responses to drive the retry path and the refusal path deliberately.
  3. Replace every exact-match assertion with structural ones, including a hedging check.
  4. Record a golden response and a type contract, and run them in CI.
  5. Split the suite into offline and paid, and report the count and wall clock of each.
  6. Confirm the offline suite passes with no key and runs in seconds.

Evidence to hand in

Review checklist