CourseLarge Language Models: The Complete Course · Module 6: Structured Outputs and Tool Use · part 43 of 103
Part 43 · Module 6: Structured Outputs and Tool Use

Lesson 2: Let the model ask your code to act

20 min read·13 Oct 2026
Module 6 · Lesson 2 · About 50 minutes · Needs: Module 6 Lesson 1 (pydantic schemas); Module 5 Lesson 1 (the refund rule decide); the guard ask from course-guide/02

The situation

It is Monday 6 July 2026, week 6. Triage now returns typed output, but the assistant still cannot look anything up. Ana Duarte's ticket T-1001 says she was charged 288 USD twice on invoice INV-2026-004512. To answer, the assistant must read the invoice, see the two charges and ask for a refund that Maya approves.

Tomasz has opened five functions for you: search_help_centre, get_workspace, get_invoice, issue_refund and escalate. This lesson gives them to the model, runs the loop that uses them, and makes sure a bad call never crashes it.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.