Function calling and other API updates
Captured source
source ↗Function calling and other API updates | OpenAI
June 13, 2023
Function calling and other API updates
We’re announcing updates including more steerable API models, function calling capabilities, longer context, and lower prices.
Loading…
Share
July 20, 2023 update:
We previously communicated to developers thatgpt-3.5-turbo-0301,gpt-4-0314 andgpt-4-32k-0314 models were scheduled for sunset on Sept 13, 2023. After reviewing feedback from customers and our community, we are extending support for those models until at least June 13, 2024.
When we release new model versions, our top priority is to make newer models smarter across the board. We are targeting improvements on a large number of axes, such as instruction following, factual accuracy, and refusal behavior. For instance, thegpt-4-0613 model introduced last month resulted in significant improvement on calling functions.
We look at a large number of evaluation metrics to determine if a new model should be released. While the majority of metrics have improved, there may be some tasks where the performance gets worse. This is why we allow API users to pin the model version. For example, you can usegpt-4-0314 instead of the genericgpt-4, which points to the latest model version. Each individually pinned model is stable, meaning that we won’t make changes that impact the outputs.
We are working hard to ensure that new versions result in improvements across a comprehensive range of tasks. That said, our evaluation methodology isn’t perfect, and we’re constantly improving it. One way to help us ensure new models get better at domains you care about, is to contribute to the OpenAI Evals library to report shortcomings in our models.
We understand that model upgrades and behavior changes can be disruptive to your applications. We are working on ways to give developers more stability and visibility into how we release and deprecate models.
---
We releasedgpt-3.5-turbo andgpt-4 earlier this year, and in only a short few months, have seen incredible applications built by developers on top of these models.
Today, we’re following up with some exciting updates:
- new function calling capability in the Chat Completions API
- updated and more steerable versions of
gpt-4andgpt-3.5-turbo - new 16k context version of
gpt-3.5-turbo(vs the standard 4k version) - 75% cost reduction on our state-of-the-art embeddings model
- 25% cost reduction on input tokens for
gpt-3.5-turbo - announcing the deprecation timeline for the
gpt-3.5-turbo-0301andgpt-4-0314models
All of these models come with the same data privacy and security guarantees we introduced on March 1 — customers own all outputs generated from their requests and their API data will not be used for training.
Function calling
Developers can now describe functions togpt-4-0613 andgpt-3.5-turbo-0613, and have the model intelligently choose to output a JSON object containing arguments to call those functions. This is a new way to more reliably connect GPT's capabilities with external tools and APIs.
These models have been fine-tuned to both detect when a function needs to be called (depending on the user’s input) and to respond with JSON that adheres to the function signature. Function calling allows developers to more reliably get structured data back from the model. For example, developers can:
- Create chatbots that answer questions by calling external tools (e.g., like ChatGPT Plugins)
Convert queries such as “Email Anya to see if she wants to get coffee next Friday” to a function call likesend_email(to: string, body: string), or “What’s the weather like in Boston?” toget_current_weather(location: string, unit: 'celsius' | 'fahrenheit').
- Convert natural language into API calls or database queries
Convert “Who are my top ten customers this month?” to an internal API call such asget_customers_by_revenue(start_date: string, end_date: string, limit: int), or “How many orders did Acme, Inc. place last month?” to a SQL query usingsql_query(query: string).
- Extract structured data from text
Define a function calledextract_people_data(people: [{name: string, birthday: string, location: string}]), to extract all people mentioned in a Wikipedia article.
These use cases are enabled by new API parameters in our/v1/chat/completions endpoint,functions andfunction_call, that allow developers to describe functions to the model via JSON Schema, and optionally ask it to call a specific function. Get started with our developer documentation and add evals if you find cases where function calling could be improved
Loading...
Since the alpha release of ChatGPT plugins, we have learned much about making tools and language models work together safely. However, there are still open research questions. For example, a proof-of-concept exploit illustrates how untrusted data from a tool’s output can instruct the model to perform unintended actions. We are working to mitigate these and other risks. Developers can protect their applications by only consuming information from trusted tools and by including user confirmation steps before performing actions with real-world impact, such as sending an email, posting online, or making a purchase.
New models
GPT-4
gpt-4-0613 includes an updated and improved model with function calling.
gpt-4-32k-0613 includes the same improvements asgpt-4-0613, along with an extended context length for better comprehension of larger texts.
With these updates, we’ll be inviting many more people from the waitlist to try GPT‑4 over the coming weeks, with the intent to remove the waitlist entirely with this model. Thank you to everyone who has been patiently waiting, we are excited to see what you build with GPT‑4!
GPT-3.5 Turbo
gpt-3.5-turbo-0613 includes the same function calling as GPT‑4 as well as more reliable steerability via the system message, two features that allow developers to guide the model's responses more effectively.
gpt-3.5-turbo-16k offers 4 times the context length ofgpt-3.5-turbo at twice the price: $0.003 per 1K input tokens and $0.004 per 1K output tokens. 16k context means the model can now support ~20 pages of text in a single request.
Model deprecations
Today, we’ll begin the upgrade and deprecation process for the initial versions ofgpt-4 andgpt-3.5-turbo that we announced in March. Applications using the stable model names…
Excerpt shown — open the source for the full document.