Glossary

Function Calling

Function calling (or tool calling) is the post-2023 successor to ad-hoc string parsing in agent loops. The developer registers a list of tool schemas with the model; the model decides whether to call one, and emits a typed JSON payload that the runtime can execute directly.

OpenAI launched function calling in gpt-3.5-turbo-0613 and gpt-4-0613 in June 2023. Anthropic added it to Claude in May 2024 and Google to Gemini shortly after. By 2025 it is a baseline capability of every frontier model.

Schema

A tool is registered with a JSON Schema description:

{
  "name": "get_weather",
  "description": "Get current weather for a location",
  "parameters": {
    "type": "object",
    "properties": {
      "location": {"type": "string"},
      "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
    },
    "required": ["location"]
  }
}

The model returns a structured response:

{
  "tool_calls": [{
    "name": "get_weather",
    "arguments": {"location": "Auckland", "unit": "celsius"}
  }]
}

The runtime executes get_weather("Auckland", "celsius"), appends the result as a tool role message, and re-invokes the model.

Implementation

Models are fine-tuned on synthetic tool-call traces so that, conditional on a tools=[...] field in the request, the decoder produces tokens that parse as valid JSON matching the schema. Modern providers reinforce this with constrained decoding (logit masking against an FSM derived from the schema) so the output is guaranteed to be syntactically valid.

Relationship to ReAct

Function calling is the native-API form of ReAct: the Action line becomes a structured tool_call field, the Observation becomes a tool role message. The Thought/Action/Observation loop is unchanged; only the wire format has been formalised.

Parallel & forced calling

Modern APIs support:

  • Parallel tool calls, the model emits multiple tool_calls in one turn (e.g. get_weather("Auckland") and get_weather("Wellington") simultaneously).
  • Forced tool choice, tool_choice: {"type": "function", "name": "X"} compels the model to call X.
  • Strict mode, guarantees schema conformance via constrained decoding.

Citation

OpenAI (2023). Function calling and other API updates. Blog post, 13 June 2023.

Related terms: Tool Use, ReAct, Structured Outputs, Constrained Decoding

Discussed in:

This site is currently in Beta. Contact: Chris Paton

Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring

AI tools used: Claude (research, coding, text), ChatGPT (diagrams, images), Grammarly (editing).