Function calling
The ability of an LLM to, given a set of predefined functions with schemas, choose which one to call and produce the arguments as structured JSON. The bridge between the model's language understanding and actual code/APIs.
Mechanic: you describe the available functions (name, description, parameters as JSON Schema) to the model; it decides from the user's question whether a function is needed, which one, and with what arguments — and returns it as a structured call instead of free text. The application runs the function and feeds the result back to the model, which formulates an answer. Win: it lets an LLM fetch real-time data (weather, a database), perform actions (book, send), and do calculations reliably. OpenAI introduced the API in 2023; now standard at all major providers and the basis for agents (where the model chains several calls). It builds on the same constrained-decoding machinery as structured output. Distinct from MCP (an open protocol for exposing tools). Related to tool use and structured output.