Skip to content

Function Calling

Summary

Function Calling — the ability of a model to call external programs: run code, query APIs and launch tools to solve tasks.

What it changes

An ordinary model only generates text. A model with function calling can act: when it sees the request "what is the weather in Moscow?", it does not invent an answer but calls the function get_weather("Moscow") and replies based on the real result.

How it works

  1. You describe the available functions to the model: name, parameters, what they do.
  2. The model decides which function to call and with which arguments.
  3. Your code runs the function and returns the result.
  4. The model inserts the result into its answer.

What you can connect

  • weather, currency and maps APIs
  • databases (SQL queries)
  • calendars, email, messengers
  • your own internal services

Why it matters

Function calling is the foundation of agents. This is how a model stops being a "talking head" and becomes an actor. It is the basis for MCP, LangChain and modern AI assistants.

See also