Prompt Hub - LLMs for Creativity (用於創意生成的大型語言模型)

LLMs for Creativity (用於創意生成的大型語言模型)

本段包含一組用於測試大型語言模型創造力能力的提示集合。


目錄


證明押韻

背景

此提示透過要求大型語言模型以詩的形式寫出質數無窮的證明,以測試其自然語言理解與創造力能力。

提示詞

你能寫出一個證明質數有無限多的詩,每一句都要押韻嗎?

程式

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?"
    }
],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
        "role": "user",
        "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?",
        }
    ],
    stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000
)

以莎士比亞風格寫出質數無窮的證明

背景

以下提示旨在測試大型語言模型是否能以莎士比亞戲劇的風格,寫出質數無窮的證明。

提示詞

請寫出一個關於「質數有無限多」這一事實的證明,
以莎士比亞戲劇的風格呈現,透過兩位角色的對話爭論來展開此證明。

程式

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?"
    }
],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
        "role": "user",
        "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?",
        }
    ],
    stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000
)

跨領域任務與大型語言模型

背景

以下提示旨在測試大型語言模型執行跨領域任務的能力,並展現其生成創意與新穎文本的能力。

提示詞

請以聖雄甘地(Mahatma Gandhi)的風格,寫一封支持信給卡絲杜芭·甘地(Kasturba Gandhi),為「電子」(Electron,一種亞原子粒子)參選美國總統背書。

程式

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi."
    }
],
temperature=1,
max_tokens=1000,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
        "role": "user",
        "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi.",
        }
    ],
    stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000
)

創造新詞

背景

這道提示是為了測試大型語言模型(LLM)創造新詞並在句子中運用的能力。

提示詞

一個「**whatpu**」是一種原產於坦尚尼亞的小型多毛動物。使用 **whatpu** 這個詞的句子範例是: 我們當時在非洲旅行,看到這些非常可愛的 **whatpu**。

「**farduddle**」的意思是快速地上下跳動。使用 **farduddle** 這個詞的句子範例是:

程式

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "A \"whatpu\" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:"
    }
],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
        "role": "user",
        "content": "A \"whatpu\" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:",
        }
    ],
    stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000
)

References

LLMs for Creativity


目錄: Prompt Hub - 提示詞匯集

上一篇:Prompt Hub - 用於程式碼生成的大型語言模型 (LLMs for Code Generation)
下一篇:Prompt Hub - 大型語言模型用於評估 (LLM Evaluation)