就在今天,OpenAI官方迎來重大更新,ChatGPT再次進化!
我們一起來看一下,ChatGPT這次帶來哪些更新:
- Chat Completions API 中新增函數調用功能
- gpt-4和的更新和更易于操縱的版本gpt-3.5-turbo
- 新的 (與标準 4k 版本相比)
- 嵌入模型成本降低了75%
- 輸入令牌成本降低 25% gpt-3.5-turbo
- gpt-3.5-turbo-0301宣布和gpt-4-0314模型的棄用時間表
關鍵詞:函數調用
OpenAI API 現在支援函數調用了,但僅限于 gpt-4-0613 和 gpt-3.5-turbo-0613 模型,其實就是支援插件了!應用場景:
- 建立聊天機器人,通過調用外部工具(例如 ChatGPT 插件)來回答問題
- 将自然語言轉換為 API 調用或資料庫查詢
- 從文本中提取結構化資料
步驟1:打開接口,使用函數和使用者輸入調用模型
curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
"model": "gpt-3.5-turbo-0613",
"messages": [
{"role": "user", "content": "What is the weather like in Boston?"}
],
"functions": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
]
}'
步驟2:調用第三方接口,使用模型響應你的 API
curl https://weatherapi.com/...
步驟 3:開放人工智能應用程式接口,将響應發送回模型進行總結
curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
"model": "gpt-3.5-turbo-0613",
"messages": [
{"role": "user", "content": "What is the weather like in Boston?"},
{"role": "assistant", "content": null, "function_call": {"name": "get_current_weather", "arguments": "{ \"location\": \"Boston, MA\"}"}},
{"role": "function", "name": "get_current_weather", "content": "{\"temperature\": "22", \"unit\": \"celsius\", \"description\": \"Sunny\"}"}
],
"functions": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
]
}'
關鍵詞:新模型釋出
GPT-4:釋出了包括函數調用在内的更新和改進的 gpt-4-0613 模型,以及具有擴充上下文長度的 gpt-4-32k-0613 模型,以便更好地了解更大的文本。
GPT-3.5 Turbo:gpt-3.5-turbo-0613 模型包括與 GPT-4 相同的函數調用功能,以及通過系統消息更可靠地控制能力,這兩個特性使開發者能夠更有效地指導模型的響應。
關鍵詞:模型退役
OpenAI 将開始為在 3 月份釋出的 gpt-4 和 gpt-3.5-turbo 的初代版本進行更新和退役。
在 6 月 27 日,使用穩定模型名稱的應用程式(gpt-3.5-turbo,gpt-4 和 gpt-4-32k)将自動更新為新版本。需要更多時間過渡的開發者可以通過在 API 請求中指定模型參數來繼續使用舊模型,這些舊模型将一直可用到 9 月 13 日。
關鍵詞:價格調整
嵌入模型價格降低:将最受歡迎的嵌入模型text-embedding-ada-002 的價格降低了 75%,至每1K tokens $0.0001。
GPT-3.5 Turbo 價格調整:gpt-3.5-turbo 的輸入 tokens 的成本降低了 25%,現在,開發者可以僅以每1K 輸入tokens $0.0015和每 1K 輸出 tokens $0.002的價格使用該模型,約等于每美元 700 頁。
gpt-3.5-turbo-16k 将定價為每 1K 輸入 tokens $0.003 和每 1K 輸出 tokens $0.004。