布景

信赖许多恳求GPT-4 API的开发者都收到OpenAI的邮件通知了,从2023.07.06初步,一切OpenAI的API付费用户都可以运用GPT-4了。

现在一切大言语模型的评测中,毫无疑问GPT-4是最亮眼的那颗星。

有了GPT-4的API,意味着开发者可以做出功用更健壮、体会更好的运用。

此外,OpenAI官方标明要扔掉Completions API,该API现在可以运用的一些Model会在2024年1月4号下线。后续OpenAI的规划是让开发者都运用Chat Completions API。

另外,Embedding的部分模型以及Edits API也会在2024年1月4号下线。

GPT-4 API全面打开

GPT-4是现在最健壮的大言语模型,从3月份打开API以来,数百万的开发者进行了恳求,有非常多成功的运用是依据GPT-4 API开发的。

从2023.07.06初步,只要有过API付费记载的开发者都可以运用GPT-4 8K上下文版其他API了。

新恳求的开发者估量2023年7月底会审批经过,然后OpenAI会依据已有的核算才干来降低API的运用流控束缚(rate limit),让开发者可以更顺畅地运用GPT-4 API。

GPT-3.5 Turbo, DALL.E和Whisper API也都会全部打开出来给开发者运用。

估量2023年下半年,依据GPT-4和GPT-3.5 Turbo模型的微调(fine-tuning)也会打开出来。

扔掉Completions API

OpenAI在2023年3月份引入了Chat Completions API,现在有大约97%的API运用量都来源于Chat Completions API。

Completions API是在2020年6月份引入的,当时是为了给开发者供应和OpenAI言语模型交互的才干。

现在有了Chat Completions API后,彻底可以掩盖Completions API的功用,而且Chat Completions API更为健壮,可以满意非常多的运用场景和对话需求。

下面简略介绍几种Chat Completions API的运用场景:

  • 文本总结(Text summarization)
System
Summarize this message in max 10 words.
User
Jupiter is the fifth planet from the Sun and the largest in the Solar System. It is a gas giant with a mass one-thousandth that of the Sun, but two-and-a-half times that of all the other planets in the Solar System combined. Jupiter is one of the brightest objects visible to the naked eye in the night sky, and has been known to ancient civilizations since before recorded history. It is named after the Roman god Jupiter. When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows, and is on average the third-brightest natural object in the night sky after the Moon and Venus.
Assistant
Jupiter: Largest planet, visible to the naked eye at night.
  • 代码补全(Code completion)
System
Complete the following code.
User
def fibonacci(num):
Assistant
if num == 0:
  return 0
elif num == 1:
  return 1
else:
  fib = [0, 1]
  for i in range(2, num + 1):
     fib.append(fib[i-1] + fib[i-2])
  return fib[num]
  • 小样本学习(Few-shot learning)
System
You translate corporate jargon into plain English.
User
New synergies will help drive top-line growth.
Assistant
Working well together will make more money.
User
Let’s circle back when we have more bandwidth to touch base on opportunities for increased leverage.
Assistant
When we’re less busy, let’s talk about how to do better.
User
This late pivot means we don’t have time to boil the ocean for the client deliverable.
Assistant
Because of this sudden change, we don’t have enough time to complete the entire project for the client.
We plan to continue investing most of our platform efforts in this direction, as we believe it will offer an increasingly capable and easy-to-use experience for developers. We’re working on closing the last few remaining gaps of the Chat Completions API quickly, such as log probabilities for completion tokens and increased steerability to reduce the “chattiness” of responses.

扔掉Completions API的旧模型

OpenAI接下来会把要点放在Chat Completions API,不再投入精力支撑Completions API。

从2023年1月4日初步,Completions API现在可以运用的一些模型会下线,开发者要持续运用Completions API,得运用新模型,参看如下表格:

Older model New model
ada ada-002
babbage babbage-002
curie curie-002
davinci davinci-002
davinci-instruct-beta gpt-3.5-turbo-instruct
curie-instruct-beta
text-ada-001
text-babbage-001
text-curie-001
text-davinci-001
text-davinci-002
text-davinci-003
  • 假设开发者运用的是依据GPT-3模型的安稳模型版别,例如ada, babbage, curie, davinci,那代码可以不必批改,这些安稳版其他模型底层会在2024年1月4日后主动晋级为上面表格里右侧的新模型。

    右侧的新模型在接下来几周打开测验,调用API的时分指定新Model的名字即可,例如 ada-002, babbage-002, curie-002, davinci-002

  • 假设开发者运用的是其他旧模型称谓,例如 text-davinci-003,那就需要在手艺批改API里调用的模型称谓为gpt-3.5-turbo-instruct,这个新模型也会在接下来几周打开测验。

同时,OpenAI也把Completions API在官网的API文档里标记为legacy,不举荐我们持续运用了。

所以还在用Completions API的赶紧去拥抱Chat Completions API吧。

扔掉Embedding旧模型

从2024年1月4日初步,只能运用text-embedding-ada-002这个Embedding Model,其它Embedding Model都会下线,不能再运用。

text-embedding-ada-002是2022年12月上线的,比其它Embedding Model更健壮而且本钱更低。现在99%的embedding API调用都在运用这个模型。

这对运用旧模型来做embedding的开发者来说是一个痛苦的工作,因为不同模型embedding的结果是不一样的,开发者需要在旧模型下线前提早做好适配和测验。

OpenAI官方许诺会补偿旧模型的用户。

Older model New model
code-search-ada-code-001 text-embedding-ada-002
code-search-ada-text-001
code-search-babbage-code-001
code-search-babbage-text-001
text-search-ada-doc-001
text-search-ada-query-001
text-search-babbage-doc-001
text-search-babbage-query-001
text-search-curie-doc-001
text-search-curie-query-001
text-search-davinci-doc-001
text-search-davinci-query-001
text-similarity-ada-001
text-similarity-babbage-001
text-similarity-curie-001
text-similarity-davinci-001

扔掉Edits API

现在Edits API可以运用text-davinci-edit-001code-davinci-edit-001这2个模型。

从2024年1月4日初步,Edits API不能运用这2个模型,要持续运用Edits API,得运用GPT-3.5 Turbo模型。

但是官方不再建议我们运用Edits API了,这个API也会扔掉。

咱们建议直接运用Chat Completions API来代替Edits API,如下例所示:

System
Apply the change requested by the user to the code.
User
def fibonacci(num):
  if num <= 1:
    return num
  else:
    return fibonacci(num-1) + fibonacci(num-2)
print(fibonacci(10))
User
Rename the function to fib.
Assistant
def fib(num):
  if num <= 1:
    return num
  else:
    return fib(num-1) + fib(num-2)
print(fib(10))

相关阅览

  • 手把手教会你如何经过ChatGPT API实现上下文对话
  • ChatGPT API重大晋级-必知必会
  • ChatGPT必会知识点
  • baichuan-7B: 开源可商用支撑中英文的最好大模型
  • 轩辕:首个千亿级中文金融对话模型
  • 迫临GPT-4!BLOOMChat: 开源可商用支撑多言语的大言语模型
  • 一文汇总开源大言语模型,人人都可以拥有自己的ChatGPT

总结

文章和示例代码开源在GitHub: GPT实战教程,了解主流LLM相关知识。

大众号:coding进阶。

个人网站:Jincheng’s Blog。

知乎:无忌。

References

  • openai.com/blog/gpt-4-…