跳到主要内容

使用字母画一个人

背景

以下提示测试了LLM处理视觉概念的能力,尽管它只接受过文本训练。这是一个对LLM来说具有挑战性的任务,因此需要多次迭代。在下面的例子中,用户首先请求一个所需的视觉效果,然后提供反馈以及更正和添加。后续指示将取决于LLM在任务中的进展。请注意,此任务要求生成TikZ代码,用户需要手动编译。

提示

提示迭代1:

生成TikZ代码,绘制一个由字母组成的人。手臂和躯干可以用字母Y,脸可以用字母O(加一些面部特征),腿可以用字母H的腿。可以添加其他特征。

提示迭代2:

躯干有点太长了,手臂太短了,而且看起来右臂在托着脸,而不是脸在躯干的正上方。能否纠正一下?

提示迭代3:

请添加衬衫和裤子。

代码 / 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
)

参考