zl程序教程

您现在的位置是:首页 >  大数据

当前栏目

五分钟进步系列之chatGpt最近发布的API

chatGPTAPI 发布 系列 最近 进步 五分钟
2023-06-13 09:17:29 时间

学习方式:

  1. 先读英文的原版,如果你能看懂就可以到此为止的了。
  2. 如果你看不懂,可以再看一下我给的较高难度的英文单词的翻译。
  3. 如果还是看不懂可以去最下面看我翻译的汉语。

下面是我在官网中找到的一段话。

一、英文原版

Introduction to the ChatGPT API

The ChatGPT model family we are releasing today, gpt-3.5-turbo, is the same model used in the ChatGPT product. It is priced at $0.002 per 1k tokens

For example, the string “ChatGPT is great!” is encoded into six tokens: [“Chat”, “G”, “PT”, “ is”, “ great”, “!”].

Both input and output tokens count toward these quantities. For example, if your API call used 10 tokens in the message input and you received 20 tokens in the message output, you would be billed for 30 tokens.

二、重点词汇的翻译

priced: (price过去式)价格

quantities: (quantity的复数)表示数量

billed:(bill的过去式)账单

三、中文

今天chatGpt家族发布了最新的版本,gpt-3.5-turbo,这个版本跟现在生产环境的ChatGPT是一个版本,它的使用价格是每1000个token价格0.002美元

关于这个token是如何定义的?举个例子 “ChatGPT is great!” 这句话,会被拆分成6个tokens,分别为: [“Chat”, “G”, “PT”, “ is”, “ great”, “!”]

输入和输出的所有字符都被计算到token的消耗账单中,举个例子:你输入了10个tokens用来询问chatGpt,然后chatGpt回给你20个tokens的答案,那么你一共用了30个tokns

四、我的测试结果

波哥今天用python测试了一下,具体dome代码为:

import openai
openai.api_key='xxxxx11222223'
completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo", 
  messages=[{"role": "user", "content": "我该如何开始在一个月能赚到100万"}]
)

print(completion.get("choices")[0].get("message").get("content"))

ChatGpt给我的答案:

初步测试对比web端的好处:

1. 随时随地访问;

2. 不受国家地区影响,能直接调用到 API;

3. 速度贼快,输出比 Web 版速度快很多,很多时候是秒出结果;

4. 省心,Web 版你不理他一会儿就报错,一言不合就 Error;