MORAIDICTIONNAIRE IA
Inférence & Prompting

Function Calling

How an LLM stops merely talking and starts triggering real software actions.

Picture a conductor who plays no instrument, yet knows exactly which musician to cue and when. Function calling gives a language model that same power: instead of answering only with text, the model can decide to invoke an external tool — a weather API, a database, a calculator — by producing a structured call that your code then executes.

How it works

You hand the model a schema describing every available function: its name, description, and parameters (typically as JSON Schema). Faced with a query, the model does not compute the answer itself — it emits a structured object such as:

Your application actually runs the function, then feeds the result back to the model, which finally writes a natural-language reply. The LLM never touches the outside world directly; it only decides what to call and with what.

Why it matters

Without function calling With function calling
Knowledge frozen at training time Fresh, real-time data
Approximate arithmetic Exact results delegated to code
Text only Concrete actions (send, book, query)

This is the building block that turns a chatbot into an AI agent: the loop "model proposes a call code executes model observes repeat" is the heart of modern agentic architectures.

Limits

The model can hallucinate arguments, pick the wrong function, or chain too many. Schema validation and execution-permission controls remain essential on the developer's side.

Function calling doesn't make the model smarter — it makes it useful, by wiring it into the real world.

Explore the full AI dictionary →