🚀 在我们的新课程中掌握提示工程和构建AI代理!使用 PROMPTING20 享受八折优惠 ➜ 立即注册
无限素数

莎士比亚风格的无限素数证明

背景

以下提示测试了 LLM 在莎士比亚戏剧风格下编写无限多素数证明的能力。

提示

Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.

代码 / API

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof."
    }
],
temperature=1,
max_tokens=1000,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)

参考