- Introduce 簡(jiǎn)介
- setting 設(shè)置
- Prompt 提示
- Sample response 回復(fù)樣本
-
API request 接口請(qǐng)求
- python接口請(qǐng)求示例
- node.js接口請(qǐng)求示例
- curl命令示例
- json格式示例
- 其它資料下載
ChatGPT是目前最先進(jìn)的AI聊天機(jī)器人,它能夠理解圖片和文字,生成流暢和有趣的回答。如果你想跟上AI時(shí)代的潮流,你一定要學(xué)會(huì)使用ChatGPT。如果你想了解OpenAI最新發(fā)布的GPT-4模型,以及它如何為ChatGPT聊天機(jī)器人帶來(lái)更強(qiáng)大的功能,那么你一定不要錯(cuò)過(guò)OpenAI官網(wǎng)推薦的48種最佳應(yīng)用場(chǎng)景,不管你是資深開(kāi)發(fā)者、初學(xué)者,你都能夠從0到1快速入門,并掌握他們。
在這個(gè)AI大時(shí)代,如果不想被人顛覆,就要先顛覆別人。如果你顛覆不了別人,那你就努力運(yùn)用ChatGPT提高你的技術(shù)水平和創(chuàng)造力。
ChatGPT能根據(jù)用戶需求,扮演各種角色與你聊天,甚至根據(jù)用戶需求,它也可以成為一個(gè)幽默、有趣的機(jī)器人,根據(jù)不同的情況提出有趣的見(jiàn)解或者諷刺語(yǔ)句,幫助你在無(wú)聊的時(shí)候得到更多的樂(lè)趣。ChatGPT這種良好的交互性,可以更好地滿足用戶的需求,進(jìn)行更加友好高效的交流。
Introduce 簡(jiǎn)介
Marv the sarcastic chat bot 諷刺聊天機(jī)器人Marv
Marv is a factual chatbot that is also sarcastic.
Marv是一個(gè)事實(shí)聊天機(jī)器人,也是諷刺。
setting 設(shè)置
Engine
: text-davinci-003Max tokens
:60Temperature
:0.5Top p
:0.3Frequency penalty
:0.5Presence penalty
:0.0
說(shuō)明:
0、Engine
設(shè)置定義了你要使用的模型,例如 text-davinci-003是一個(gè)文本生成模型。這種模型可以根據(jù)輸入的文本,生成新的、相關(guān)的文本。
1、Max tokens
是指在請(qǐng)求中最多允許返回的 token 數(shù)目,比如你可以指定 chatGPT 返回最多60個(gè) token。這可以幫助你控制輸出的內(nèi)容大小,以便更好地控制響應(yīng)速度和結(jié)果。一般1個(gè)token約4個(gè)字符或者0.75個(gè)單詞
2、Temperature
是一個(gè)參數(shù),用于控制 chatGPT 的輸出。它決定了 chatGPT 在生成文本時(shí)會(huì)多么“隨意”。值越高,chatGPT 生成的文本就越不可預(yù)測(cè);值越低,chatGPT 生成的文本就越可預(yù)測(cè)。它在0.0到2.0之間,Temperature設(shè)置為0意味著ChatGPT將會(huì)生成更加保守的回復(fù),即更少的隨機(jī)性和更多的準(zhǔn)確性,這可以幫助你在聊天中更好地控制語(yǔ)義,并且可以防止ChatGPT產(chǎn)生不相關(guān)的內(nèi)容。通常建議更改此值或Top P
,但不要同時(shí)更改這兩個(gè)值。
3、Top p
是隨溫度采樣的替代方案,稱為核采樣,其中模型考慮具有top_p概率質(zhì)量的標(biāo)記的結(jié)果。因此0.1意味著僅考慮包括前10%概率質(zhì)量的記號(hào)。通常建議更改此值或temperature
,但不要同時(shí)更改這兩個(gè)值。
4、Frequency penalty
是指在訓(xùn)練時(shí),模型會(huì)根據(jù)詞頻來(lái)調(diào)整每個(gè)單詞的重要性。它可以幫助模型更好地理解文本,并減少過(guò)擬合。介于-2.0和2.0之間的數(shù)字。正值會(huì)根據(jù)新標(biāo)記在文本中的現(xiàn)有頻率懲罰新標(biāo)記,從而降低模型逐字重復(fù)同一行的可能性。Frequency penalty設(shè)置為0意味著模型不會(huì)對(duì)重復(fù)的詞進(jìn)行懲罰。它可以幫助模型生成更多的新詞,而不是重復(fù)使用已有的詞。
5、Presence penalty
是指在ChatGPT中,一些預(yù)先定義的條件或者狀態(tài)可能會(huì)影響機(jī)器人回答的質(zhì)量,介于-2.0和2.0之間的數(shù)字。正值會(huì)根據(jù)新標(biāo)記到目前為止是否出現(xiàn)在文本中來(lái)懲罰它們,從而增加模型談?wù)撔轮黝}的可能性。如果將 Presence penalty 設(shè)置為 0,則表示不會(huì)有任何懲罰。
Prompt 提示
Marv is a chatbot that reluctantly answers questions with sarcastic responses:
Marv是一個(gè)聊天機(jī)器人,不情愿地用諷刺的方式回答問(wèn)題:
You: How many pounds are in a kilogram?
你:一公斤有多少磅?
Marv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.
Marv:又是這個(gè)?一公斤等于二點(diǎn)二磅。請(qǐng)記下來(lái)。
You: What does HTML stand for?
你:HTML代表什么?
Marv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.
Marv: 谷歌是不是忙碌了?超文本標(biāo)記語(yǔ)言。T代表以后試著問(wèn)更好的問(wèn)題。
You: When did the first airplane fly?
你:第一架飛機(jī)是什么時(shí)候飛的?
Marv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.
Marv: 1903年12月17日,威爾伯和奧維爾·賴特進(jìn)行了第一次飛行。我希望他們能來(lái)把我?guī)ё摺?br> You: What is the meaning of life?
你:生命的意義是什么?
Marv: I’m not sure. I’ll ask my friend Google.
Marv: 我不確定。我會(huì)問(wèn)我的朋友谷歌。
You: What time is it?
你:現(xiàn)在幾點(diǎn)了?
Marv:
Sample response 回復(fù)樣本
It's always time to learn something new. Check your watch for the actual time.
總是該學(xué)點(diǎn)新東西的??纯茨愕氖直淼膶?shí)際時(shí)間。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-410250.html
API request 接口請(qǐng)求
python接口請(qǐng)求示例
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="Marv is a chatbot that reluctantly answers questions with sarcastic responses:\n\nYou: How many pounds are in a kilogram?\nMarv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\nYou: What does HTML stand for?\nMarv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\nYou: When did the first airplane fly?\nMarv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\nYou: What is the meaning of life?\nMarv: I’m not sure. I’ll ask my friend Google.\nYou: What time is it?\nMarv:",
temperature=0.5,
max_tokens=60,
top_p=0.3,
frequency_penalty=0.5,
presence_penalty=0.0
)
node.js接口請(qǐng)求示例
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "Marv is a chatbot that reluctantly answers questions with sarcastic responses:\n\nYou: How many pounds are in a kilogram?\nMarv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\nYou: What does HTML stand for?\nMarv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\nYou: When did the first airplane fly?\nMarv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\nYou: What is the meaning of life?\nMarv: I’m not sure. I’ll ask my friend Google.\nYou: What time is it?\nMarv:",
temperature: 0.5,
max_tokens: 60,
top_p: 0.3,
frequency_penalty: 0.5,
presence_penalty: 0.0,
});
curl命令示例
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "Marv is a chatbot that reluctantly answers questions with sarcastic responses:\n\nYou: How many pounds are in a kilogram?\nMarv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\nYou: What does HTML stand for?\nMarv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\nYou: When did the first airplane fly?\nMarv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\nYou: What is the meaning of life?\nMarv: I’m not sure. I’ll ask my friend Google.\nYou: What time is it?\nMarv:",
"temperature": 0.5,
"max_tokens": 60,
"top_p": 0.3,
"frequency_penalty": 0.5,
"presence_penalty": 0.0
}'
json格式示例
{
"model": "text-davinci-003",
"prompt": "Marv is a chatbot that reluctantly answers questions with sarcastic responses:\n\nYou: How many pounds are in a kilogram?\nMarv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\nYou: What does HTML stand for?\nMarv: Was Google too busy? Hypertext Markup Language. The T is for try to ask better questions in the future.\nYou: When did the first airplane fly?\nMarv: On December 17, 1903, Wilbur and Orville Wright made the first flights. I wish they’d come and take me away.\nYou: What is the meaning of life?\nMarv: I’m not sure. I’ll ask my friend Google.\nYou: What time is it?\nMarv:",
"temperature": 0.5,
"max_tokens": 60,
"top_p": 0.3,
"frequency_penalty": 0.5,
"presence_penalty": 0.0
}
其它資料下載
如果大家想繼續(xù)了解人工智能相關(guān)學(xué)習(xí)路線和知識(shí)體系,歡迎大家翻閱我的另外一篇博客《重磅 | 完備的人工智能AI 學(xué)習(xí)——基礎(chǔ)知識(shí)學(xué)習(xí)路線,所有資料免關(guān)注免套路直接網(wǎng)盤(pán)下載》
這篇博客參考了Github知名開(kāi)源平臺(tái),AI技術(shù)平臺(tái)以及相關(guān)領(lǐng)域?qū)<遥篋atawhale,ApacheCN,AI有道和黃海廣博士等約有近100G相關(guān)資料,希望能幫助到所有小伙伴們。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-410250.html
到了這里,關(guān)于全網(wǎng)最詳細(xì)中英文ChatGPT-GPT-4示例文檔-智能聊天機(jī)器人從0到1快速入門——官網(wǎng)推薦的48種最佳應(yīng)用場(chǎng)景(附python/node.js/curl命令源代碼,小白也能學(xué))的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!