Skip to content
Book a conversation

Function calling

Understand how a model requests functions with arguments and how the application executes the request and returns its result.

Luiz GardelinUpdated Read in Markdown
All terms

A conversation about your organization.

Before recommending any tool, we talk with your teams and map how the work really happens.

Arrange a conversation
On this pageIntroduction

Also used as: function call.

Function calling is a way for a model to request a function provided by an application, specifying the required arguments. In OpenAI's documentation, the function is presented to the model with a description and a data schema. The model may produce a structured request instead of answering the person directly. The application executes the corresponding code and returns its result in a separate step. OpenAI, function calling.

A request does not execute code by itself

The documented flow separates five stages:

  1. Offer tools to the model.
  2. Receive the call requested by the model.
  3. Execute code on the application side.
  4. Send the tool result to the model.
  5. Receive another response, which may contain final text or further calls. The separation between model and application is central: the model requests an operation, while the program integrating it determines how to handle the request. These details describe OpenAI's interface rather than a format every provider must use. OpenAI, the tool calling flow.

In a hypothetical example, someone asks for the status of an internal request. The model calls the lookup function with the supplied identifier. The application checks the identifier and access, queries the system, and returns “awaiting documents.” The model then uses that result to explain progress. If the lookup is refused, the initial call does not justify inventing a status.

Format and authorization answer different questions

A schema can specify that an identifier must be text and that certain fields are mandatory. The documentation also offers strict mode for schema adherence, with its own requirements. That concerns the form of the arguments. A correctly formatted identifier may still refer to a request the person has no permission to view. OpenAI, schemas and strict mode.

Access checks and business rules therefore need to exist in the application. Looking up a status and requesting a status change would also be separate functions in this example. An agent tool describes an available capability; a call records a particular request to use it. Understanding the outcome requires following the arguments, the execution result, and the response built from that result, rather than treating the model's request as proof of completion.

Sources

  1. Function calling OpenAI

    The model requests a function, while the application executes code and returns the result; schema adherence does not determine access authorization.

Written by

Luiz Gardelin

Founder and lead consultant at The Company Brain

Luiz Gardelin is the founder and lead consultant at The Company Brain, an AI organizational transformation consultancy based in Brazil. He also founded Webinhood and Tropk.ai.

See all content by this author

A conversation about your organization.

Before recommending any tool, we talk with your teams and map how the work really happens.

Arrange a conversation

Related terms

Continue reading

All resources