AI Glossary

Function Calling

The ability of language models to generate structured output that invokes external tools, APIs, or functions, extending their capabilities beyond text generation.

How It Works

The model is given descriptions of available functions (name, parameters, purpose). When a user query requires external data or actions, the model generates a structured function call (typically JSON). The application executes the function and feeds results back to the model.

Examples

Querying a database, checking the weather, sending an email, searching the web, running code, calling a calculator, or interacting with any API. Function calling turns LLMs from text generators into general-purpose AI agents.

Implementation

OpenAI, Anthropic, and other providers offer native function calling APIs. Models are specifically trained to generate well-formed function calls and to decide when a function call is needed vs. when to answer directly.

← Back to AI Glossary

Last updated: March 5, 2026