🚀 在我们的新课程中掌握 Prompt Engineering 和构建 AI Agent!使用 PROMPTING20 享受 8 折优惠 ➜ 立即报名
绘制 TiKZ 图

绘制 TiKZ 图

背景

此 prompt 通过要求 LLM 在 TiKZ 中绘制独角兽来测试其代码生成能力。在下面的示例中,模型应该生成 LaTeX 代码,然后可以使用该代码生成独角兽或传递的任何对象。

Prompt

Draw a unicorn in TiKZ

代码 / API

from openai import OpenAI
client = OpenAI()
 
response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {
        "role": "user",
        "content": "Draw a unicorn in TiKZ"
        }
    ],
    temperature=1,
    max_tokens=1000,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0
)

参考