ChatGPT是目前最先進的AI聊天機器人,它能夠理解圖片和文字,生成流暢和有趣的回答。如果你想跟上AI時代的潮流,你一定要學會使用ChatGPT。如果你想了解OpenAI最新發布的GPT-4模型,以及它如何為ChatGPT聊天機器人帶來更強大的功能,那麼你一定不要錯過OpenAI官網推薦的48種最佳應用場景,不管你是資深開發者、初學者,你都能夠從0到1快速入門,並掌握他們。
在這個AI大時代,如果不想被人顛覆,就要先顛覆別人。如果你顛覆不了別人,那你就努力運用ChatGPT提高你的技術水平和創造力。
ChatGPT可以利用自然語言理解和生成的能力,來處理非結構化資料。非結構化資料是指沒有預定義的資料模型,不方便用資料庫二維邏輯表來儲存和查詢的資料。ChatGPT可以將非結構化資料解析成結構化資料,例如表格、圖表、列表等,從而方便使用者進行分析和決策。例如,ChatGPT可以從一篇文章中提取出關鍵資訊,並生成一個摘要表格;或者可以從一張圖片中識別出物體,並生成一個標籤列表。
Introduce 簡介
Parse unstructured data 解析非結構化資料
Create tables from long form text by specifying a structure and supplying some examples.
透過指定結構並提供一些示例,從長格式文字建立表格。
setting 設定
Engine
: text-davinci-003
Max tokens
:100
Temperature
:0
Top p
:1.0
Frequency penalty
:0.0
Presence penalty
:0.0
說明:
0、Engine
設定定義了你要使用的模型,例如 text-davinci-003 是一個文字生成模型。這種模型可以根據輸入的文字,生成新的、相關的文字。
1、Max tokens
是指在請求中最多允許返回的 token 數目,比如你可以指定 chatGPT 返回最多 100個 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 提示
A table summarizing the fruits from Goocrux: Goocrux的水果表格
There are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.
| Fruit | Color | Flavor |
在最近發現的Goocrux行星上發現了許多水果。那裡生長著neoskizzles,紫色的,吃起來像糖果。還有loheckles,這是一種灰藍色的水果,非常酸,有點像檸檬。pounits是一個明亮的綠色,是更多的鹹味比甜。也有大量的loopnovas,這是一個氖粉紅色的味道,嚐起來像棉花糖。最後,還有一種水果叫glowls,它有一種非常酸和苦的味道,是酸性和腐蝕性的,並有一種淡橙色調。
| 水果|顏色|風味|
Sample response 回覆樣本
| Neoskizzles | Purple | Candy |
| Loheckles | Grayish Blue | Tart, like a lemon |
| Pounits | Bright Green | Savory |
| Loopnovas | Neon Pink | Cotton Candy |
| Glowls | Pale Orange | Sour and Bitter, Acidic and Caustic |
API request 介面請求
python介面請求示例
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="A table summarizing the fruits from Goocrux:\n\nThere are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.\n\n| Fruit | Color | Flavor |",
temperature=0,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.0,
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: "A table summarizing the fruits from Goocrux:\n\nThere are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.\n\n| Fruit | Color | Flavor |",
temperature: 0,
max_tokens: 100,
top_p: 1.0,
frequency_penalty: 0.0,
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": "A table summarizing the fruits from Goocrux:\n\nThere are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.\n\n| Fruit | Color | Flavor |",
"temperature": 0,
"max_tokens": 100,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0
}'
json格式示例
{
"model": "text-davinci-003",
"prompt": "A table summarizing the fruits from Goocrux:\n\nThere are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.\n\n| Fruit | Color | Flavor |",
"temperature": 0,
"max_tokens": 100,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0
}
其它資料下載
如果大家想繼續瞭解人工智慧相關學習路線和知識體系,歡迎大家翻閱我的另外一篇部落格《重磅 | 完備的人工智慧AI 學習——基礎知識學習路線,所有資料免關注免套路直接網盤下載》
這篇部落格參考了Github知名開源平臺,AI技術平臺以及相關領域專家:Datawhale,ApacheCN,AI有道和黃海廣博士等約有近100G相關資料,希望能幫助到所有小夥伴們。