AI and LLMs · Middle · Question 28 of 75
How do you unit-test code that calls an LLM without paying for each run?
- 1Call the real model with the lowest temperature
- 2Skip testing that code, since it can't be tested
- 3Mock the model client with recorded or fake responses
Show the answer
Correct answer: Mock the model client with recorded or fake responses
Explanation
Code around the model (parsing, retries, tool execution) can be tested deterministically. Separate evals test the model's quality.