IA 360
GPT-4

OpenAI Adds Function Calling: GPT-4 Now Invokes Tools

OpenAI has introduced function calling to its API, letting GPT-4 and GPT-3.5-turbo generate JSON arguments to invoke external functions—a key step toward agents that act on other systems.

4 min read Leer en español

OpenAI announced an API update today that changes how developers connect their models to the rest of their software: "function calling." From now on, GPT-4 and GPT-3.5-turbo can return, instead of free-form text, a JSON object with a function name and the arguments needed to run it.

What exactly changes

Until now, if a developer wanted an OpenAI model to check the weather, look up a flight, or insert data into a database, they had to ask for a text response and then write custom code to try to extract the useful data from it, risking formatting or interpretation errors. It's a fragile process: the model might respond with "it's about 20 degrees" instead of a clean number, or change the format of a call from one response to the next.

With the new feature, developers describe one or more available "functions" to the API: their name, a natural-language description, and a JSON schema with the parameters they accept. The model, specifically trained for this task, decides during the conversation whether to invoke one of them and returns a structured, valid JSON response with the corresponding arguments. The developer then handles actually executing the function (calling an external API, querying a database, running a calculation) and can feed the result back to the model so it can continue the conversation with that information.

New model versions

Alongside function calling, OpenAI has released new dated versions of its chat models: gpt-4-0613, gpt-4-32k-0613, gpt-3.5-turbo-0613, and gpt-3.5-turbo-16k-0613. The last one is especially notable because it quadruples gpt-3.5-turbo's usual context window, from 4,000 to 16,000 tokens, allowing it to process much longer documents or conversations without losing track of what was said at the start.

OpenAI also used the announcement to cut API prices, both for gpt-3.5-turbo's input tokens and for its text-embedding-ada-002 embedding model, used for semantic search and text classification tasks.

Why this is a foundational piece

Function calling isn't a flashy end-user feature — it's developer infrastructure. But it's the infrastructure that was missing to reliably build what the industry is starting to call "agents": systems that don't just converse but act on other programs, query real data, and execute tasks. Projects like the early autonomous agent experiments circulating in recent months had until now relied on fragile workarounds to get a language model to return something resembling an executable instruction. OpenAI solves that problem at the root by training the model itself to do it properly.

The immediate applications are concrete: turning natural-language questions into database queries, building chatbots that query third-party APIs (weather, flights, inventory), or extracting structured information from long texts without manual text-parsing rules.

What it means for the ecosystem

The update arrives at a moment when dozens of companies are building products on top of OpenAI's API and needed exactly this: a predictable way to integrate the models with their existing systems. By solving it from the model provider's side, OpenAI removes a substantial chunk of the engineering work that had previously fallen on each developer individually, and will likely set the standard other language model providers will have to match.

OpenAI also noted that the previous versions, gpt-4-0314 and gpt-3.5-turbo-0301, will remain available for a year before being replaced by the new ones, giving developers time to migrate their applications without rushing.

Share this article

This website uses cookies to improve the browsing experience. Cookie policy.