AI & LLMs · Intermediate
Function Calling
Letting a model do more than answer: it can ask an outside program to act — check live weather, do exact arithmetic, send email, read a file. It's the step that turns an AI from something that only talks into something that gets things done.
TL;DRIn 30 seconds
- It opens a door for the model so it can call outside programs to do the work, instead of only replying in words.
- Live information, exact arithmetic, sending email, reading files — this is the step that turns talking into acting.
- Which tools it can use is configured in advance; anything not connected is out of reach however much it wants it.
OverviewIn detail
By default a model only emits text. Ask it whether you need an umbrella tomorrow and it may reply suggesting you check the weather — it agrees, but its hands haven't moved. Function calling opens a door for it: the model can request, in an agreed format, that an outside program perform an action, take the result, and carry on building its answer. The model decides what to do; the actual doing is handed to a program.
This capability addresses exactly the things a model is naturally bad at. It doesn't know live information, it slips on exact arithmetic, and it can't touch actions like sending email, editing a spreadsheet or reading a file at all. Hand those to outside tools and the model only judges which one to use and what to pass in. It never sees the data behind the tool either — only the result that comes back.
Ask an assistant for the opening hours of a nearby shop and it first calls a map API, then tells you when it closes — that's one function call. Within a single answer it can chain several tools together. What it can do depends on how many tools the developer wired up and which capabilities each one exposes.
Two things are easily misread. It isn't the model writing a program and running it, but making a request under rules fixed in advance. And what it can call isn't unlimited: a tool that was never connected can't be used, however much the model might want it. So when an assistant seems able to do very little, it's usually that not enough tools were configured rather than the model being weak. And faced with something it truly can't do, it tends to fall back on describing it in words rather than admitting defeat.
MythsCommon misunderstandings
- ✕Thinking the model writes a program and runs it ✓It makes requests under rules fixed in advance — it doesn't write code on the spot
- ✕Thinking the model can use any tool ✓Only the handful the developer connected can be called; what isn't connected doesn't exist
- ✕Thinking it says so when it can't do something ✓It usually falls back on a written description instead of telling you it can't
In practiceWhere you will meet it
- Asking an assistant for a nearby shop's opening hours and it calling a map API before answering
- Chaining lookups and calculations within one answer before writing up a conclusion
- Noticing an assistant can do very little and checking whether the tools were ever connected
SummaryThe key points
- Lets the model ask an outside program to perform an action
- Live data, accurate arithmetic and sending mail all depend on it
- Turns a model from talk-only into something that gets things done
- Which tools are available is configured in advance by the developer
FAQ
What does Function Calling mean?
It opens a door for the model so it can call outside programs to do the work, instead of only replying in words.Live information, exact arithmetic, sending email, reading files — this is the step that turns talking into acting.Which tools it can use is configured in advance; anything not connected is out of reach however much it wants it.
Where will I run into Function Calling?
Asking an assistant for a nearby shop's opening hours and it calling a map API before answering;Chaining lookups and calculations within one answer before writing up a conclusion;Noticing an assistant can do very little and checking whether the tools were ever connected。
What do people most often get wrong about Function Calling?
Thinking the model writes a program and runs it — but It makes requests under rules fixed in advance — it doesn't write code on the spot;Thinking the model can use any tool — but Only the handful the developer connected can be called; what isn't connected doesn't exist。
What are the key points about Function Calling?
Lets the model ask an outside program to perform an action;Live data, accurate arithmetic and sending mail all depend on it;Turns a model from talk-only into something that gets things done;Which tools are available is configured in advance by the developer。
Common pitfalls A model doesn't conjure new abilities — a tool that was never connected simply isn't available to it.
Also written asYou may also see it written as
These are all the same concept — the same thing, however it is written in a skill description. Do not mistake different spellings for different ideas.
Entry 28 of 186 · All entries
Keep readingRelated reading
AI Agent
An AI program that sets its own goal, breaks it into steps and calls tools to get the job done. You hand it a task and it works out how to do it — instead of only answering one question at a time.
LLM
A very large program that learned to predict the next piece of text after reading an ocean of it. Whatever you type, it is guessing what is most likely to come next — writing, translating and answering questions are all the same thing used differently.
嵌入(Embedding)
把一段文字换算成一串数字,让电脑能比较哪两句话意思更接近。搜索和知识库能在换了说法时也找对答案,靠的就是它。
Claude
A large language model built by Anthropic, known for understanding long documents, writing well and writing code. It comes both as a chat assistant on the web and phone, and in a dedicated form for programming.
Prompt
The message you send to an AI — the instruction or question you give it. How well that passage is written decides whether the answer that comes back is on target.
MCP
A standard interface that lets AI connect to outside tools and data in one uniform way. Build a tool to it once and any AI assistant can call it, saving you from writing a separate integration for each tool.
Where to go nextExplore more
Back to the skills themselves
Most of the concepts covered here come from skills that install into your AI client with a single command.