Skip to content
AI Glossary

Function Calling

An API feature in which an LLM returns a structured call (function name plus JSON arguments) that matches a schema you declared, instead of free text.

Definition

Function calling is the API mechanism behind tool use. You send the model a list of function definitions, each with a name, a description and a JSON Schema for its parameters. The model may then answer with a function call: the name it chose and a JSON object of arguments that conforms to the schema. Your code executes the function and sends the result back; the model continues from there.

The important property is structure. Instead of parsing "I think you should look up order 88-1204" out of a paragraph, you receive {"name": "get_order", "arguments": {"id": "88-1204"}}. Models are trained specifically to produce valid calls, and most providers constrain the output to the schema. The same trick is often used purely for extraction: define a function whose arguments are the fields you want.

Example: an invoice-processing service declares record_invoice(supplier, number, total, currency, due_date). For each uploaded PDF the model returns one call with the five fields filled in, ready to insert into the accounts system.

Why it matters for your business

  • Makes LLM output machine-usable, which is the difference between a demo and an integration.
  • Reduces parsing errors and retries, and so reduces cost and latency.
  • Lets existing APIs be exposed to a model without rewriting them.
  • Arguments are model-generated and must be validated; the schema is a hint to the model, not a security control.

How Teksmobile uses it

Function calling is how our AI integration work connects models to ERPs, CRMs and in-house APIs, and how document processing solutions return clean, typed records. In LLM application development we treat every function as an API endpoint with its own validation and permissions.

Part of the Teksmobile AI Glossary. For longer reads, see our guides.

FAQ

Frequently asked questions

Is function calling the same as tool use?

Essentially yes. "Function calling" is the term used by OpenAI and several other providers; Anthropic calls the same capability tool use. Both return structured calls against a schema you define.

Can I use function calling just to get structured output?

Yes, and it is a common trick: declare a single "function" whose arguments are the fields you want extracted. Several providers now also offer dedicated structured-output modes for this.

What happens when the arguments are wrong?

Validate them in your code before executing anything, and return a clear error message to the model so it can correct itself. Never trust generated arguments blindly.

Ready to make AI work in production?

Tell us about your systems, your data and your constraints. We reply within one business day with a straight answer and a suggested next step.