Function Calling
A capability that lets a language model request execution of predefined functions or tools by outputting structured arguments, enabling AI to take real actions.
What Is Function Calling?
Function calling (also called tool use) is the mechanism by which a language model connects to the outside world. The developer describes a set of available functions — their names, descriptions, and parameter schemas — and the model, when appropriate, responds not with prose but with a structured request to call one of those functions with specific arguments. The application executes the function, returns the result to the model, and the model continues, now informed by real data.
For example, given a function get_weather(city), if a user asks "What is the weather in Tokyo?", the model outputs a structured call like {"name": "get_weather", "arguments": {"city": "Tokyo"}}. The application runs the actual weather API and feeds the result back. This bridges the gap between the model's frozen training knowledge and live, dynamic, or private data — and it is the core building block of AI agents.
Why It Matters
Function calling transforms a language model from a text generator into an action-taking system. It is the foundation of agentic AI, retrieval pipelines, and any application where the model must fetch live data, perform calculations, or trigger operations in other software. Without it, models can only describe actions; with it, they can reliably orchestrate real tools through a structured, parseable interface.
Real-World Examples
Live Data Lookup
A travel assistant calls a flights API through function calling to return real prices instead of guessing from training data.