chatgpt文本aigc測(cè)試
測(cè)試方式
采集了一些英文關(guān)鍵字,簡(jiǎn)單使用write a story about + 關(guān)鍵字作為輸入,調(diào)用api進(jìn)行內(nèi)容生成
在測(cè)試了ada、babbage、curie、davinci四種算法后,最終發(fā)現(xiàn)最貴的davinci還是效果最好。
循環(huán)隨機(jī)調(diào)用5000次api,最終統(tǒng)計(jì)結(jié)果。目前只進(jìn)行了英文的測(cè)試
結(jié)果
5000篇story的結(jié)果最長(zhǎng)的有1900字符,最少的有116字符,差異非常大。
最短的長(zhǎng)這樣:
I'm obsessing over my new A-line lace evening dress. It's so perfect for my upcoming event. I can't wait to wear it!
比較長(zhǎng)的比較有可讀性,故事邏輯簡(jiǎn)單有點(diǎn)像兒童讀物。
chatgpt api調(diào)用費(fèi)用的計(jì)算方式
和常見(jiàn)的其他api不太一樣,是根據(jù)輸出和輸入的內(nèi)容長(zhǎng)度算錢(qián)的,官網(wǎng)給了18美元的試用費(fèi)用。注冊(cè)賬號(hào)的成本不到1美元,有羊毛可以薅。

實(shí)際計(jì)算是prompt(輸入字符串)的單詞數(shù)量+輸出字符串的單詞數(shù)量,輸出的長(zhǎng)度可以被max_tokens控制最大長(zhǎng)度,但限制太小的話內(nèi)容會(huì)被截?cái)?。?jīng)過(guò)測(cè)試設(shè)置到600就沒(méi)有再出現(xiàn)截?cái)嗟那闆r。
chatgpt api的不穩(wěn)定
調(diào)用頻率超過(guò)1qps就會(huì)出現(xiàn)超頻錯(cuò)誤,經(jīng)過(guò)測(cè)試,實(shí)際上最好在3s以上才會(huì)較穩(wěn)定的輸出內(nèi)容。
服務(wù)器返回的內(nèi)部timeout和內(nèi)部錯(cuò)誤偶爾有出現(xiàn),大概千分之一的概率。不過(guò)在國(guó)內(nèi)調(diào)用api倒是出奇的穩(wěn)定,沒(méi)有發(fā)生過(guò)網(wǎng)絡(luò)timeout
其他注意事項(xiàng)
由于輸入也會(huì)計(jì)算價(jià)格,因此盡量減少輸入的長(zhǎng)度。比如write story: snow和write a story about snow對(duì)chatgpt沒(méi)有區(qū)別,只要ai能夠正確理解意思,就不需要考慮語(yǔ)法正確(甚至單詞正確)等問(wèn)題。
api輸出的結(jié)果經(jīng)常帶有很多的換行,如果輸出的內(nèi)容需要在某些供人工閱讀的地方使用,最好去掉這些多余的換行
api和頁(yè)面不一樣,api沒(méi)有上下文的概念,因此同個(gè)問(wèn)題反復(fù)問(wèn)可能得到完全不一樣的回答。
客戶端的選擇
個(gè)人覺(jué)得最簡(jiǎn)單的選擇是node,一共只有這些代碼,而且代碼也是chatgpt寫(xiě)的
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
?apiKey: "yourkey",
});
const openai = new OpenAIApi(configuration);
async function callChatGpt(prompt){
? ?const response = await openai.createCompletion({
? ? ? ?model: "text-davinci-003",
? ? ? ?prompt: prompt,
? ? ? ?max_tokens: 100,
? ?})
? ?if(typeof response.data.choices[0].text === "undefined"){
? ? ? ?throw new Error(response.data)
? ?}
? ?return response.data.choices[0].text
}
callChatGpt("write story about snow").then(v => console.log(v))
chatgpt的問(wèn)題
在嘗試提取內(nèi)容的時(shí)候,出現(xiàn)了問(wèn)題:沒(méi)有辦法固定輸出結(jié)果。
例如輸入:
extract keywords from "A new study found that the so-called 'Doomsday Glacier' is melting unpredictably and could drive catastrophic sea rise"
輸出的格式有時(shí)候是1、2、3這樣的數(shù)字列表,有時(shí)候是無(wú)序列表,有時(shí)候還帶有)這樣的符號(hào)。
除了格式不一樣,內(nèi)容也大相徑庭。有時(shí)候返回預(yù)期的內(nèi)容
? ?New study
? ?Doomsday Glacier
? ?Melting
? ?Unpredictably
? ?Catastrophic
? ?Sea rise
有時(shí)候返回的是用每個(gè)關(guān)鍵字?jǐn)U展出來(lái)的句式
? ?A new study found that the so-called "Doomsday Glacier" is melting unpredictably and could drive catastrophic sea rise.
? ?The researchers conducted a new study on the effects of climate change on the Doomsday Glacier.
? ?The study analyzed satellite imagery and ocean data to track the glacier's melting patterns over time.
? ?The researchers found evidence that the glacier is melting much faster than previously predicted.
? ?that: The study revealed that the melting of the Doomsday Glacier could have devastating effects on global sea levels.
? ?The so-called "Doomsday Glacier" has been a source of concern for climate scientists due to its potential impact on the environment.
為了方便處理,強(qiáng)制輸出格式
extract keywords from "A new study found that the so-called 'Doomsday Glacier' is melting unpredictably and could drive catastrophic sea rise" to json format
結(jié)果確實(shí)輸出了json,但執(zhí)行多次后,結(jié)果也有差異
有map結(jié)構(gòu)的
{
?"new": true,
?"study": true,
?"found": true,
?"Doomsday Glacier": true,
?"melting": true,
?"unpredictably": true,
?"catastrophic": true,
?"sea rise": true
}
有數(shù)組的:
{
?"keywords": [
? ?"new study",
? ?"Doomsday Glacier",
? ?"melting",
? ?"unpredictably",
? ?"catastrophic",
? ?"sea rise"
?]
}
結(jié)論
在一些不太嚴(yán)謹(jǐn)?shù)膱?chǎng)合,aigc已經(jīng)可以替代人工進(jìn)行輸出,但對(duì)結(jié)果要做一定的篩選,不能100%符合要求。比如要求寫(xiě)一篇1000字的文章,寫(xiě)出來(lái)的可能是800-2000+。

更多互聯(lián)網(wǎng)新鮮事兒,快來(lái)公眾號(hào)「迷路idea」找我一起探討。