{"id":594,"date":"2023-06-13T18:13:34","date_gmt":"2023-06-13T18:13:34","guid":{"rendered":"https:\/\/todaysainews.com\/index.php\/2023\/06\/13\/function-calling-and-other-api-updates\/"},"modified":"2025-04-27T07:33:22","modified_gmt":"2025-04-27T07:33:22","slug":"function-calling-and-other-api-updates","status":"publish","type":"post","link":"https:\/\/todaysainews.com\/index.php\/2023\/06\/13\/function-calling-and-other-api-updates\/","title":{"rendered":"Function calling and other API updates"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div>\n<div>\n<p>Developers can now describe functions to <code>gpt-4-0613<\/code> and <code>gpt-3.5-turbo-0613<\/code>, 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&#8217;s capabilities with external tools and APIs.<\/p>\n<p>These models have been fine-tuned to both detect when a function needs to be called (depending on the user\u2019s 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:<\/p>\n<ul>\n<li>Create chatbots that answer questions by calling external tools (e.g., like ChatGPT Plugins)<\/li>\n<\/ul>\n<p>Convert queries such as \u201cEmail Anya to see if she wants to get coffee next Friday\u201d to a function call like <code>send_email(to: string, body: string)<\/code>, or \u201cWhat\u2019s the weather like in Boston?\u201d to <code>get_current_weather(location: string, unit: 'celsius' | 'fahrenheit')<\/code>.<\/p>\n<ul>\n<li>Convert natural language into API calls or database queries<\/li>\n<\/ul>\n<p>Convert \u201cWho are my top ten customers this month?\u201d to an internal API call such as <code>get_customers_by_revenue(start_date: string, end_date: string, limit: int)<\/code>, or \u201cHow many orders did Acme, Inc. place last month?\u201d to a SQL query using <code>sql_query(query: string)<\/code>.<\/p>\n<ul>\n<li>Extract structured data from text<\/li>\n<\/ul>\n<p>Define a function called <code>extract_people_data(people: [{name: string, birthday: string, location: string}])<\/code>, to extract all people mentioned in a Wikipedia article.<\/p>\n<p>These use cases are enabled by new API parameters in our <code>\/v1\/chat\/completions<\/code> endpoint, <code>functions<\/code> and <code>function_call<\/code>, 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 <a href=\"https:\/\/platform.openai.com\/docs\/guides\/gpt\/function-calling\" rel=\"noopener noreferrer\" target=\"_blank\">developer documentation<\/a> and <a href=\"https:\/\/github.com\/openai\/evals\" rel=\"noopener noreferrer\" target=\"_blank\">add evals<\/a> if you find cases where function calling could be improved<br class=\"softbreak\"\/><\/p>\n<\/div>\n<\/div>\n<p>[ad_2]<br \/>\n<br \/><a href=\"https:\/\/openai.com\/blog\/function-calling-and-other-api-updates\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Developers can now describe functions to gpt-4-0613 and gpt-3.5-turbo-0613, and have the model intelligently choose to output<\/p>\n","protected":false},"author":2,"featured_media":595,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openai"],"_links":{"self":[{"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/posts\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/comments?post=594"}],"version-history":[{"count":1,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/posts\/594\/revisions"}],"predecessor-version":[{"id":2776,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/posts\/594\/revisions\/2776"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/media\/595"}],"wp:attachment":[{"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/media?parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/categories?post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todaysainews.com\/index.php\/wp-json\/wp\/v2\/tags?post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}