Week 03 — Tool Use
| Material | Where |
|---|---|
| HTML chapter | Read online |
| Lab | Open in Colab · W3_lab_tools.ipynb download |
| Homework | Open in Colab · W3_hw_new_tool.ipynb download — collected via the LMS; due date on the LMS |
| Papers | Toolformer (Schick et al., 2023) (PDF) · ToolLLM (Qin et al., 2023) (PDF) · optional: ReTool (2025) (PDF) |
| Student presentation slides | Toolformer |
This week
Define a clock function, describe its purpose and parameters in the system prompt, and follow the model’s request through Python execution to an answer. Then automate the same steps, connect search to a forecast, and briefly introduce Toolformer training. The displayed clock reading and museum example are illustrative.
The lab follows six stages in 75 minutes: why tools are needed; one request/execution/result cycle by hand; the same cycle with aisuite; weather capabilities; search-to-forecast composition; and a conclusion separating model generation from Python execution. Weather progresses from one city to two cities, then to tomorrow’s forecast. In the visit example, inspect whether the model searches for the destination’s municipality and uses the returned location in a later forecast request, or requests the forecast directly. Code, comments, and prompts are in English. The provided notebook runs as-is; the optional system-instruction comparison sits beside the missing-forecast example in §4.4 and adds about 5 minutes. There is no automatic lab score.
Homework
W3_hw_new_tool.ipynb — search, then compute. The model gets two tools at once: the lab’s web_search and a small function you write. Three assignments: a currency conversion (the rate comes from a search), the number of days between two searched dates, and a tool and question of your own that need both a search and your computation. For each, you complete the function, add it to the tool list, run the request, and read the trace. The notebook’s last cell checks only the format of your work (function, docstring with Args:, search-then-tool order in the trace); the values are graded after submission. Run the notebook top to bottom, download it (File → Download → Download .ipynb), and upload the file to the LMS by the due date shown there.