Agents & Tools · beginner
Function Calling
Function calling is the specific API mechanism by which an LLM emits a structured request to invoke a named function with typed arguments. The OpenAI-popularized way to do tool use.
Explanation
You supply the model with a JSON schema describing each function (name, description, parameter types). The model decides when to call one and emits a structured payload that your code can parse and execute. The result is fed back as a tool message in the next turn.
Function calling differs from older "let the model emit JSON in plain text" patterns by being a first-class output mode: the provider guarantees valid JSON and routes the message into a distinct tool channel.
Examples
- OpenAI's tools parameter and tool_calls response.
- Anthropic's tool_use content blocks.
Frequently asked
What is Function Calling?
Function calling is the specific API mechanism by which an LLM emits a structured request to invoke a named function with typed arguments. The OpenAI-popularized way to do tool use.
What is an example of function calling?
OpenAI's tools parameter and tool_calls response.
How is Function Calling related to Tool Use?
Function Calling and Tool Use are both agents & tools concepts. Tool use is when an LLM can call external functions — APIs, code interpreters, databases, web fetchers — and read their results. The mechanism that turns chat into action.
Is Function Calling considered beginner?
Function Calling is generally considered beginner-level material in the AI and LLM space.