Function Calling.
A capability that allows language models to return structured calls to developer-defined functions or tools, enabling AI systems to interact with external APIs, databases, and services.
Function calling is a structured interface that enables language models to invoke external tools, APIs, and services by returning properly formatted function calls instead of just generating text. This capability transforms LLMs from passive text generators into active agents that can perform real-world tasks like querying databases, making API requests, executing code, or controlling external systems. Function calling bridges the gap between language understanding and actionable computation, making it a foundational technology for AI agents and tool-augmented applications.
When a model supports function calling, developers define available functions with schemas that specify parameters, types, and descriptions. The model analyzes user requests and determines when to call functions, returning structured JSON with the function name and arguments rather than attempting to answer directly. The developer's application then executes the actual function call and provides results back to the model, which can incorporate this information into its response. This differs from simple text generation because the model must understand tool capabilities, reason about when to use them, and format calls correctly according to predefined schemas.
Function calling enables sophisticated AI applications like coding assistants that can execute code, research agents that query multiple data sources, and customer service bots that access real-time information. However, it requires careful prompt engineering to prevent the model from calling inappropriate functions or hallucinating function parameters. The quality of function calling varies significantly between models, with some excelling at complex multi-step tool use while others struggle with parameter formatting or knowing when not to call functions. This capability is essential for building reliable AI agents but demands robust error handling and validation in production systems.