Lesson 1 · Unit 03
Tool calling
A call is structured text; your code runs it and replies
What you practise
- A tool is a name, a description and a JSON schema
- The model emits a call, the program runs it and returns the result
- The request-and-response loop traced message by message
Try a question from this lesson
Pick one
A user asks for the weather in Oslo right now. The model has no live data and can only write text. The app has a weather function. What must the model write?
Correct answer
The function name and arguments in a form code can parse
Why
A model can only write text, so a tool call is text in an agreed structure: which function, which arguments. The app parses it, runs the real function and sends the result back. The model asks; your code acts.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
A tool is three things
A tool definition is a name, a description in plain language and a JSON schema for the input. Providers give the schema field different names, but the three parts are always there.
The definitions travel with the request, next to the messages.
{
"name": "get_weather",
"description": "Weather in a city now.",
"input_schema": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}Concept
The model asks, your code acts
The model never runs anything. A tool call is a request, and your code may validate it, refuse it or carry it out.
The result is appended to the conversation as a new message and the model is called again, now with the result in view. One question that needs one tool therefore takes two model calls.
9 more exercises in the app
- 2× multiple choice
- 1× order the lines
- 3× type the answer
- 1× fill the blanks
- 1× true or false
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.