function calling
In plain wordsA feature of AI model services that lets the model reply with a neatly formatted request to run one of a program's functions, rather than with ordinary text; the program, not the model, then runs it.
An API feature that lets a large language modellarge language model, n.: A computer program trained on enormous amounts of text to predict the words that come next. At vast scale, that simple skill lets it chat, answer questions, translate, summarize and write code. answer with a machine-readable request to run code instead of, or alongside, prose: the developer lists the available functions, each with a name, a statement of purpose and a JSON SchemaJSON Schema, prop. n.: A standard way of writing down exactly what a piece of JSON data must look like — which fields, of which types — so that software and AI models can check it or follow it. for its parameters, and the model may return the name of one plus arguments that fit its schema. Running the function is left to the application, which checks the arguments, executes the call and passes the result back in a follow-up message so the model can continue. Function calling is the mechanism beneath most tool usetool use, n.: An AI model's ability to reach beyond its own knowledge by operating outside tools — searching the web, running code, using a calculator or an app — and folding the results into its work. and agentsAI agent, n.: An AI system that does not just answer but acts: given a goal, it decides on steps, uses tools such as a browser or code editor, checks the results and keeps going until the job is done.; refinements include forcing or forbidding calls, several calls in one turn (parallel function calling) and guaranteed schema adherence through constrained decodingconstrained decoding, n.: Forcing an AI model's output to follow a required format — such as valid code or a fill-in form — by blocking, at every step, any word that would break the rules.. Models are fine-tuned on call formats, so reliability varies between models and falls as the number of functions grows or their descriptions get vaguer.
We use function calling to turn a booking request into a call to reserve_table with party size and time filled in.
Origin
Introduced under this name by OpenAI on 13 June 2023 for its gpt-4-0613 and gpt-3.5-turbo-0613 models, which accepted functions described in JSON Schema and returned a JSON object of arguments. Anthropic, Google and open-weight model families shipped equivalent 'tool use' features in 2023–2024, and 'function calling' and 'tool calling' became interchangeable.
Usage note
Not the same as structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork. or JSON modeJSON mode, n.: A setting on some AI services that makes the model reply only in JSON, a standard text format for data, so that programs can read the reply reliably., which constrain the format of a whole response; with function calling the model chooses whether and which function to call. The Model Context ProtocolModel Context Protocol, prop. n.: An open standard that lets AI assistants plug into outside apps and data — files, calendars, databases, business software — through one common connector instead of a custom link for every pairing; often likened to a USB-C port for AI. standardizes how tools are served; function calling is how a model requests them.
Related
- tool calltool call, n.: A single request from an AI model to use one of its tools — naming the tool and filling in the details — which the surrounding software then carries out and reports back on.
- tool usetool use, n.: An AI model's ability to reach beyond its own knowledge by operating outside tools — searching the web, running code, using a calculator or an app — and folding the results into its work.
- tooltool, n.: Any outside capability an AI model is allowed to use — a web search, a calculator, a code runner, a database or an app — described to the model so it can ask for it by name.
- structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork.
- JSON SchemaJSON Schema, prop. n.: A standard way of writing down exactly what a piece of JSON data must look like — which fields, of which types — so that software and AI models can check it or follow it.
- Model Context ProtocolModel Context Protocol, prop. n.: An open standard that lets AI assistants plug into outside apps and data — files, calendars, databases, business software — through one common connector instead of a custom link for every pairing; often likened to a USB-C port for AI.
- constrained decodingconstrained decoding, n.: Forcing an AI model's output to follow a required format — such as valid code or a fill-in form — by blocking, at every step, any word that would break the rules.
- structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork.
- JSON modeJSON mode, n.: A setting on some AI services that makes the model reply only in JSON, a standard text format for data, so that programs can read the reply reliably.
Sources
- OpenAI (2023). Function calling and other API updates. OpenAI blog, 13 June 2023. openai.com/index/function-calling-and-other-api-updates
Mentioned in
Model Context ProtocolModel Context Protocol, prop. n.: An open standard that lets AI assistants plug into outside apps and data — files, calendars, databases, business software — through one common connector instead of a custom link for every pairing; often likened to a USB-C port for AI., agent loopagent loop, n.: The repeating cycle at the heart of an AI agent: the model decides what to do next, software carries it out, the result is shown to the model, and the cycle repeats until the task is finished., AutoGPTAutoGPT, prop. n.: A 2023 open-source program that gave GPT-4 a goal and let it run on its own — planning, searching the web and writing files in a loop — becoming the first viral 'autonomous AI agent'., JSON SchemaJSON Schema, prop. n.: A standard way of writing down exactly what a piece of JSON data must look like — which fields, of which types — so that software and AI models can check it or follow it., ReActReAct, prop. n.: A method in which an AI alternates between thinking out loud about what to do next and taking an action, such as a web search, then uses what it observed to plan its next step., structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork., τ-benchτ-bench, prop. n.: A test of AI customer-service agents in which a simulated customer, played by another AI, chats with the agent, which must use company tools and follow written rules to resolve the request., tooltool, n.: Any outside capability an AI model is allowed to use — a web search, a calculator, a code runner, a database or an app — described to the model so it can ask for it by name., tool calltool call, n.: A single request from an AI model to use one of its tools — naming the tool and filling in the details — which the surrounding software then carries out and reports back on., tool usetool use, n.: An AI model's ability to reach beyond its own knowledge by operating outside tools — searching the web, running code, using a calculator or an app — and folding the results into its work., ChatGPT pluginsChatGPT plugins, prop. n.: Add-ons, launched in 2023 and retired in 2024, that let ChatGPT use outside services — web browsing, a code runner, travel booking or shopping sites — while answering a user., code modecode mode, n.: A way for AI agents to use tools by writing a short program that calls them, instead of asking for each tool one step at a time., JSON modeJSON mode, n.: A setting on some AI services that makes the model reply only in JSON, a standard text format for data, so that programs can read the reply reliably., MRKL systemMRKL system, n.: An early design, pronounced 'miracle', in which a language model acts as a switchboard, sending each part of a question to the right specialist — a calculator, a database, a search tool — and combining the answers., semantic parsingsemantic parsing, n.: Translating a sentence into a precise, machine-executable form — such as a database query or a logical formula — so that a computer can act on what was asked., ToolformerToolformer, prop. n.: A 2023 Meta research model that learned on its own when a tool — a calendar, a translator, a search engine, a calculator — would help it predict text, keeping only the tool uses that actually paid off.