Originally published on my blog. Cross-posted here with a canonical link.
When you ask an LLM "Compare the weather in Tokyo and Berlin," what actually happens? The model can't browse the internet — but it can decide to call a weather API. Twice. In the same turn.
This article covers how function calling works, how the LLM returns structured data despite generating tokens one by one, and what happens when the model needs to orchestrate multiple tool calls to answer a single question.
Part 1: What Is Function Calling?
"Function calling" is one of several ways to get output from an LLM API. Here are the three main methods:






