Docs

Function calling

What function calling is, how it differs from a model that writes text, and how Fern models compare with other models that make decisions.

Function calling, also called tool calling, is when a model answers with a structured call to one of a fixed set of functions instead of writing text. Fern models do nothing else: every answer is a call to one of your tools, or a signal that the request is out of scope.

Generated text and a tool call

Take one line from a store's inbox: "the mug in order 4821 arrived cracked, I want a refund".

A chat model writes a reply:

I'm sorry your mug arrived damaged. I can help with a refund. Could you confirm...

That is useful to a person, but your system can't act on a paragraph. Someone has to read it, or code has to parse it, and the next reply may be worded differently.

A function-calling model returns the operation itself:

{ "name": "create_refund", "arguments": { "order_id": 4821, "reason": "damaged" } }

Your code can check that call against your tool's definition and run it.

Why structured answers help

  • Nothing to parse. The answer already has the shape your code needs: a tool name and typed arguments.
  • A fixed set of answers. The model was trained only on your tools, so its answers are calls to those tools. When it does produce a call that doesn't match, Studio shows it, and the Retrain tab lists calls to tools that don't exist as <unknown>.
  • Easy to check. You can compare each call with your schema before running it, and show the user what will happen first. The intent bar does this.
  • Measurable. Either the call is right or it isn't, so accuracy is a number you can track across training runs.

A model that makes one decision

Each request to a Fern model is one decision: which tool, with which arguments. There is no planning loop, no chain of reasoning and no retry. That makes it a good fit for work that repeats with small variations:

  • turning a search sentence into filters,
  • routing a ticket or a request to the right queue,
  • applying the same edit to a set of records,
  • choosing which API call a form or a message should trigger.

It is a poor fit for open-ended work, such as answering questions from documents, writing text, or tasks that need several steps where each depends on the last.

Fern models and general-purpose models

General-purpose models such as GPT-4o also support function calling. You send the list of tools with every request, and the model chooses one.

Fern modelGeneral-purpose model with tool use
How it learns your toolsFine-tuned once on your tools and examplesReads the tool list in every request
What it knowsYour tools onlyGeneral knowledge as well as your tools
Cost per requestFixed by your plan, with no per-token chargeCharged by length, and the tool list is resent every time
SpeedBuilt for short answers, and small enough to respond quicklyDepends on the provider and the size of the request
Changing the toolsRetrain the modelEdit the tool list
Suited toHigh volume and a fixed set of actionsVaried requests and open-ended tasks

The playground puts a Fern model and GPT-4o side by side on the same requests, with each one's accuracy and time.

Fern models and other decision models

Other models are built for the same kind of narrow, repeated decision. Jev, from TypeSafe AI, opened early access in September 2026: it returns typed decisions with confidence scores rather than text, and like Fern models it is built for speed and low cost on decisions that repeat.

What Fernfly is built around:

  • Your own API. Each project is a model fine-tuned on your tools and your examples, and its answers are calls to your API with arguments filled in.
  • Training from your traffic. Requests your model missed, and fixes your users made in the intent bar, become training data when you retrain.
  • An interface for your users. The intent bar puts the model in front of users in your app, and shows them each call before your app runs it.

When you compare decision models, test them on your own requests. The things that matter most are how often each picks the right action and arguments for the sentences your users actually write, and what that costs at your volume.

Revised

Was this page helpful?