Module 03 Activity
Scenario
Make one real call and handle its response properly, including the three ways it can be less than it appears.
What you build
A call wrapper that reads the whole response object, checks the finish reason, and logs enough to explain the call later.
Steps
- Build a three-role message list and print it. Say where retrieved data should live and why.
- Read the whole response object, not just the text. Record finish reason, usage and model.
- Deliberately set a low output limit and observe truncation. Confirm it raises nothing.
- Stream a response, accumulate the chunks, and measure time to first chunk against time to complete.
- Write a log line that explains the call without containing its content.
- Include the prompt version and the model version.
Evidence to hand in
- The rendered message list with the role decision.
- The full response object.
- A truncated response with its finish reason.
- Both latency measurements.
- One log line.
Review checklist
- Retrieved data is placed deliberately, with a stated reason.
finish_reasonis checked on every call.- Truncation was reproduced and shown to raise nothing.
- Chunks are accumulated rather than fetched twice.
- The log line carries both versions and no content.
