OpenAI 终于发力了,今天凌晨更新了一大波内容,让我们一起来看看:
gpt-4-0613
和 gpt-3.5-turbo-0613
模型gpt-3.5-turbo-16k
模型gpt-3.5-turbo
模型 tokens 成本降低 25%gpt-3.5-turbo-0301
和 gpt-4-0314
模型即将被废弃OpenAI API 现在支持函数调用了,但仅限于 gpt-4-0613
和 gpt-3.5-turbo-0613
模型,其实就是支持插件了!应用场景:
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"]
}
}
]
}'
响应:
{
"id": "chatcmpl-123",
...
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "get_current_weather",
"arguments": "{ \"location\": \"Boston, MA\"}"
}
},
"finish_reason": "function_call"
}]
}
2、调用第三方 API
请求:
curl https://weatherapi.com/...
响应:
{ "temperature": 22, "unit": "celsius", "description": "Sunny" }
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"]
}
}
]
}'
响应:
{
"id": "chatcmpl-123",
...
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "The weather in Boston is currently sunny with a temperature of 22 degrees Celsius.",
},
"finish_reason": "stop"
}]
}
GPT-4 新增了 2 个模型,gpt-4-0613
和 gpt-4-32k-0613
,均支持函数调用,并且支持更长的上下文和更好的语义理解。
GPT-3.5 新增了 2 个模型,gpt-3.5-turbo-0613
和 gpt-3.5-turbo-16k
。
gpt-3.5-turbo-0613
支持函数调用,并且对 system 类型的消息具有更好的控制,响应速度更快!
gpt-3.5-turbo-16k
支持更长的上下文,单个请求中支持约 20 页文本输入。
gpt-3.5-turbo-0301
,gpt-4-0314
以及 gpt-4-32k-0314
即将废弃使用。
text-embedding-ada-002
成本降低 75%,现在费用是 $0.0001/1K tokens
gpt-3.5-turbo
成本降低 25%,费用明细:
输入:$0.0015/1K input tokens
输出:$0.002/1K output tokens
gpt-3.5-turbo-16k
费用明细:
输入:$0.003/1K input tokens
输出:$0.004/1K output tokens
总的来说就是新增了函数调用功能,更长的上下文支持,更低的成本。
树先生开发的 ChatGPT 镜像网址也在第一时间更新了上述模型,欢迎体验!函数调用功能即将更新,敬请期待~
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有