🚀 在我们的新课程中掌握提示工程和构建 AI 代理!使用 PROMPTING20 享 8 折优惠 ➜ 立即报名
使用字母画人

使用字母画人

背景

以下提示旨在测试 LLM 处理视觉概念的能力,尽管其仅通过文本进行训练。这对 LLM 来说是一项具有挑战性的任务,因此需要多次迭代。在下面的示例中,用户首先提出期望的视觉效果,然后提供反馈以及修正和补充。后续指令将取决于 LLM 在任务中取得的进展。请注意,此任务要求生成 TikZ 代码,这需要用户手动编译。

提示

提示迭代 1

Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.

提示迭代 2

The torso is a bit too long, the arms are too short and it looks like the right arm is carrying the face instead of the face being right above the torso. Could you correct this please?

提示迭代 3

Please add a shirt and pants.

代码 / API

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
model="gpt-4",
messages=[
    {
    "role": "user",
    "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.."
    }
],
temperature=1,
max_tokens=1000,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)

参考