Tool use
A tool call is the model asking your program to do something: look up a name in the GND authority file, ask Wikidata a question, run a SPARQL query. The model only proposes the call. A person approves, corrects or refuses it, Python runs it, and the result goes back to the model.
Notebook 05, 05_tool_use, takes about 15 minutes in the workshop. It defines three tools as plain Python functions and shows the gate, the step where you decide whether a call runs. It then corrects a misspelled name, chains a GND lookup to Wikidata and the Historical Dictionary of Switzerland, and deliberately triggers the failure the loop is built to catch: an identifier the model made up.
What the notebook covers
- Define tools as plain Python functions with docstrings.
- Let the model propose a call; approve it, correct it or refuse it; feed the result back.
- Chain two tools: GND identifier, then Wikidata, then the Historical Dictionary of Switzerland.
- Recognize the failure modes (the ways the model goes wrong) and what the loop does about them.
The pages
Tool use builds on structured output, because a tool call is a small structured record. It also builds on RAG, for the questions a document index cannot answer.