Function Calling and Enhanced Capabilities: OpenAI's Latest Updates to API Models

OpenAI has recently announced a series of updates to their API models, including more steerable API models, function calling capabilities, longer context, and lower prices. These updates are designed to enhance the capabilities of the models and provide developers with more flexibility and control.

OpenAI New Updates - Function Calling & Cost Reduction


What are the new updates?

One of the most exciting updates is the new function calling capability in the Chat Completions API. This feature allows developers to describe functions to GPT-4 and GPT-3.5 Turbo, 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.

For example, developers can create chatbots that answer questions by calling external tools (e.g., like ChatGPT Plugins), convert natural language into API calls or database queries, or extract structured data from text sources. This feature is enabled by new API parameters in the /v1/chat/completions endpoint, functions and function_call, that allow developers to describe functions to the model via JSON Schema, and optionally ask it to call a specific function.

With function calling, developers can unlock a wide range of possibilities, such as:

Interactive Chatbots:

Build chatbots that not only engage in conversational interactions but also seamlessly integrate with external tools. For instance, a chatbot could retrieve real-time flight information by calling an airline's API or provide personalized product recommendations by connecting to an e-commerce platform.

Smart Data Retrieval:

Transform natural language queries into structured data by leveraging function calling. For example, developers can convert queries like "Retrieve the latest stock prices for Apple" into a function call that retrieves data from a financial data provider's API or a custom-built database. Another example could be -

"Find the nearest coffee shop from my location" to get_nearest_coffee_shop(user_location: coordinates).

Intelligent Automation:

Enable AI-powered automation by converting natural language instructions into actionable tasks. Developers can design functions that translate instructions like "Schedule a meeting with John and Lisa next Monday" into calendar events using APIs such as Google Calendar. Another example could be -

Convert queries such as "Create a task for John to review the project proposal by tomorrow" to a function call like create_task(assignee: string, task_description: string, due_date: date).

Contextual Information Extraction:

Extract specific structured data from unstructured text using custom functions. For instance, developers can create a function that identifies and extracts relevant information from news articles, such as headlines, publication dates, and article summaries. For example: Define a function named extract_company_data(companies: [{name: string, founded: string, industry: string, headquarters: string}]). This function is designed to extract information about various companies mentioned in a given text source, such as a news article or a blog post.

These are just a few examples of the limitless potential function calling brings to developers. Through OpenAI's new API parameters, namely functions and function_call in the /v1/chat/completions endpoint, developers can describe functions to the models using JSON Schema. Additionally, they have the flexibility to specify a particular function to be called, further enhancing control and customization.

OpenAI encourages developers to explore the possibilities of function calling and provide valuable feedback to improve this powerful feature.

Another update is the improved and more steerable versions of GPT-4 and GPT-3.5 Turbo. These models have been fine-tuned to allow developers to exert greater control over the model's output by crafting the context, specifying desired formatting, and providing instructions to the model about the desired output. For example, developers can control the tone, style, and content of the responses generated by the models used in their applications.

A third update is the new 16k context version of GPT-3.5 Turbo, which differs from the GPT-3.5 model behind ChatGPT, as it was specifically tailored for developers to create chat-based applications. The latest 16k model is an upgraded variant from the standard, previously used 4k model. The context in "16k context" is used to describe the text within a conversation that helps provide context and helps the model understand the input and provide responses that are relevant to the conversation.

The last update is the cost reduction on the Embeddings model and the input tokens for GPT-3.5 Turbo. The Embeddings model is a state-of-the-art model that produces high-quality embeddings for any text input. The cost of using this model has been reduced by 75%, making it more affordable for developers who want to use it for tasks such as text classification, clustering, or similarity search. The input tokens for GPT-3.5 Turbo are the units of text that are fed into the model for generating completions. The cost of using these tokens has been reduced by 25%, making it more economical for developers who want to use longer inputs or generate longer outputs.

How Important are the updates?

These updates mark a significant development in the field of AI, offering remarkable flexibility and efficiency in model responses, as well as opening new opportunities for practical applications, such as summarization, information extraction, and natural language conversion into API calls or database queries.

These updates also demonstrate OpenAI's commitment to providing developers with access to cutting-edge AI models that are easy to use, secure, and affordable. OpenAI's API models come with data privacy and security guarantees that ensure customers own all outputs generated from their requests and their API data will not be used for training.

How can developers get started with these updates?

Developers who want to get started with these updates can visit OpenAI's website and sign up for an account. They can also check out OpenAI's developer documentation for more details on how to use these new features and parameters. Additionally, they can explore some examples of applications built by other developers using OpenAI's API models on OpenAI's showcase page. 

More information on these updates is available on OpenAI's blog here at - https://openai.com/blog/function-calling-and-other-api-updates


Also Read:


No comments: