目錄
- Introduce 簡介
- setting 設定
- Prompt 提示
- Sample response 回復樣本
- API request 介面請求
- python介面請求示例
- node.js介面請求示例
- curl命令示例
- json格式示例
- 其它資料下載

ChatGPT是目前最先進的AI聊天機器人,它能夠理解圖片和文字,生成流暢和有趣的回答,如果你想跟上AI時代的潮流,你一定要學會使用ChatGPT,如果你想了解OpenAI最新發布的GPT-4模型,以及它如何為ChatGPT聊天機器人帶來更強大的功能,那么你一定不要錯過OpenAI官網推薦的48種最佳應用場景,不管你是資深開發者、初學者,你都能夠從0到1快速入門,并掌握他們,
在這個AI大時代,如果不想被人顛覆,就要先顛覆別人,如果你顛覆不了別人,那你就努力運用ChatGPT提高你的技術水平和創造力,
ChatGPT絕對是一款絕佳的AI輔助寫作工具,可以根據主題和輸入生成文字,并自動處理表達、語法、文字型別等,更加快速、有效地將您的主題輸入和想法轉化為一個完整的、連貫的故事,同時ChatGPT 還可以協助您對內容進行優化,例如:比較自然的語氣、更多的同義詞變換、精準的修正及深度重新組織等等,最重要的是,它不會像人類那樣出現錯誤或者犯錯,因為它是一個完全智能的 AI 系統,
Introduce 簡介
Micro horror story creator 微恐怖故事創作者
Creates two to three sentence short horror stories from a topic input.
從主題輸入創建兩到三句簡短的恐怖故事,
setting 設定
Engine: text-davinci-003
Max tokens:60
Temperature:0.8
Top p:1.0
Frequency penalty:0.5
Presence penalty:0.0
說明:
0、Engine設定定義了你要使用的模型,例如 text-davinci-003是一個文本生成模型,這種模型可以根據輸入的文本,生成新的、相關的文本,
1、Max tokens是指在請求中最多允許回傳的 token 數目,比如你可以指定 chatGPT 回傳最多60個 token,這可以幫助你控制輸出的內容大小,以便更好地控制回應速度和結果,一般1個token約4個字符或者0.75個單詞
2、Temperature是一個引數,用于控制 chatGPT 的輸出,它決定了 chatGPT 在生成文本時會多么“隨意”,值越高,chatGPT 生成的文本就越不可預測;值越低,chatGPT 生成的文本就越可預測,它在0.0到2.0之間,Temperature設定為0意味著ChatGPT將會生成更加保守的回復,即更少的隨機性和更多的準確性,這可以幫助你在聊天中更好地控制語意,并且可以防止ChatGPT產生不相關的內容,通常建議更改此值或Top P,但不要同時更改這兩個值,
3、Top p是隨溫度采樣的替代方案,稱為核采樣,其中模型考慮具有top_p概率質量的標記的結果,因此0.1意味著僅考慮包括前10%概率質量的記號,通常建議更改此值或temperature,但不要同時更改這兩個值,
4、Frequency penalty是指在訓練時,模型會根據詞頻來調整每個單詞的重要性,它可以幫助模型更好地理解文本,并減少過擬合,介于-2.0和2.0之間的數字,正值會根據新標記在文本中的現有頻率懲罰新標記,從而降低模型逐字重復同一行的可能性,Frequency penalty設定為0意味著模型不會對重復的詞進行懲罰,它可以幫助模型生成更多的新詞,而不是重復使用已有的詞,
5、Presence penalty是指在ChatGPT中,一些預先定義的條件或者狀態可能會影響機器人回答的質量,介于-2.0和2.0之間的數字,正值會根據新標記到目前為止是否出現在文本中來懲罰它們,從而增加模型談論新主題的可能性,如果將 Presence penalty 設定為 0,則表示不會有任何懲罰,
Prompt 提示
Topic: Breakfast
Two-Sentence Horror Story: He always stops crying when I pour the milk on his cereal. I just have to remember not to let him see his face on the carton.
Topic: Wind
Two-Sentence Horror Story:
主題:早餐
兩句恐怖故事:每次我把牛奶倒在他的麥片粥里他總是不哭,我只要記住別讓他看到紙箱上自己的臉,
主題:風
兩句恐怖故事:
Sample response 回復樣本
The wind howled through the night, shaking the windows of the house with a sinister force. As I stepped outside, I could feel it calling out to me, beckoning me to follow its chilling path.
風在夜里呼嘯著,以一種邪惡的力量搖晃著房子的窗戶,當我走出去時,我能感覺到它在召喚我,召喚我沿著它冰冷的道路前進,
API request 介面請求
python介面請求示例
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="Topic: Breakfast\nTwo-Sentence Horror Story: He always stops crying when I pour the milk on his cereal. I just have to remember not to let him see his face on the carton.\n \nTopic: Wind\nTwo-Sentence Horror Story:",
temperature=0.8,
max_tokens=60,
top_p=1.0,
frequency_penalty=0.5,
presence_penalty=0.0
)
node.js介面請求示例
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: "Topic: Breakfast\nTwo-Sentence Horror Story: He always stops crying when I pour the milk on his cereal. I just have to remember not to let him see his face on the carton.\n \nTopic: Wind\nTwo-Sentence Horror Story:",
temperature: 0.8,
max_tokens: 60,
top_p: 1.0,
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": "Topic: Breakfast\nTwo-Sentence Horror Story: He always stops crying when I pour the milk on his cereal. I just have to remember not to let him see his face on the carton.\n \nTopic: Wind\nTwo-Sentence Horror Story:",
"temperature": 0.8,
"max_tokens": 60,
"top_p": 1.0,
"frequency_penalty": 0.5,
"presence_penalty": 0.0
}'
json格式示例
{
"model": "text-davinci-003",
"prompt": "Topic: Breakfast\nTwo-Sentence Horror Story: He always stops crying when I pour the milk on his cereal. I just have to remember not to let him see his face on the carton.\n \nTopic: Wind\nTwo-Sentence Horror Story:",
"temperature": 0.8,
"max_tokens": 60,
"top_p": 1.0,
"frequency_penalty": 0.5,
"presence_penalty": 0.0
}
其它資料下載
如果大家想繼續了解人工智能相關學習路線和知識體系,歡迎大家翻閱我的另外一篇博客《重磅 | 完備的人工智能AI 學習——基礎知識學習路線,所有資料免關注免套路直接網盤下載》
這篇博客參考了Github知名開源平臺,AI技術平臺以及相關領域專家:Datawhale,ApacheCN,AI有道和黃海廣博士等約有近100G相關資料,希望能幫助到所有小伙伴們,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/549107.html
標籤:其他
上一篇:讀破萬卷,神交古人,突破ChatGPT4096的Token限制,建立自己的垂直領域資料人工智能助理
下一篇:全網最詳細中英文ChatGPT-GPT-4示例檔案-智能AI寫作從0到1快速入門——官網推薦的48種最佳應用場景(附python/node.js/curl命令源代碼,小白也能學)
