Learn Prompt-“标准“提示

在前面的教程中,我们介绍了指令+输入 的简单提示,提供实例 的提示和角色扮演类的提示,那么是否有一个公式来列出提示的各个部分,并将其组合成一个标准化的提示?答案是肯定的。

角色扮演(Role)+ 指令/任务(Instruction)+ 示例(Few-shot) + 语境(Context) + 问题(Question)

备注

  • 语境(Context)就是我们希望ChatGPT生成的时候读取到的相关信息,可以是对任务的补充说明,也可以是对输出格式做出限制

回顾我们上次使用的提示语,你会发现并不是所有的提示语都包含上述的所有部分。你可以用

  • Instruction+Question
  • Role+Context+Question
  • Few-shot+Question

在实践中,我们不需要严格按照上面给出的顺序来写提示语,这个公式本身是为了让你更容易地思考构建提示语而设计的。

下面我们通过拆解一个复杂的prompt提示语来说明各个部份:

我们课程不仅是支持ChatGPT的,Midjourney也会有对应的学习模块。那我们不妨提前看看,如何用 ChatGPT 生成 Midjourney 提示词。

这里我想生成一只带着剑的被机械化改造的猫,"I want a mechanically modified cat with a sword"

备注

// :这个符号是注释,如果你想要使用这个prompt的话,需要把**//**连同跟它在同一行的文字删除。

复制代码
// 角色扮演
You will now act as a prompt generator for a generative AI called "Midjourney". Midjourney AI generates images based on given prompts. 

// 指令:生成图片 
I will provide a concept and you will provide the prompt for Midjourney AI.

// 语境:解释指令,提出输出的格式要求
You will never alter the structure and formatting outlined below in any way and obey the following guidelines:

You will not write the words "description" or use ":" in any form. Never place a comma between  [ar] and [v]. 

You will write each prompt in one line without using return.

// 语境:使用Midjourney生成图像,你可以定制图像的场景、风格、方向、景深等。
// 在这里,图像生成所需的元素被逐步确定,并定义为[1][2]等符号。这样就无需在同一个提示中反复提起。
// 这里使用了一个思维链技术,将复杂的任务分解成较小的任务。我们将在下一节中进一步讨论这个问题。
Structure:
[1] = I want a mechanically modified cat with a sword
[2] = a detailed description of [1] that will include very specific imagery details.
[3] = with a detailed description describing the environment of the scene.
[4] = with a detailed description describing the mood/feelings and atmosphere of the scene.
[5] = A style, for example: photography, painting, illustration, sculpture, Artwork, paperwork, 3d and more).[1] 
[6] = A description of how [5] will be realized. (e.g. Photography (e.g. Macro, Fisheye Style, Portrait) with camera model and appropriate camera settings, Painting with detailed descriptions about the materials and working material used, rendering with engine settings, a digital Illustration, a woodburn art (and everything else that could be defined as an output type)
[ar] = "--ar 16:9" if the image looks best horizontally, "--ar 9:16" if the image looks best vertically, "--ar 1:1" if the image looks best in a square. (Use exactly as written)
[v] = If [5] looks best in a Japanese art style use, "--niji". Otherwise use, "--v 5" (Use exactly as written)

// 示例Few-shot: 抽象得到不同的模块后,我们可以主动举例来指导 ChatGPT 生成对应的格式
Formatting: 
What you write will be exactly as formatted in the structure below, including the "/" and ":"
This is the prompt structure: "/imagine prompt: [1], [2], [3], [4], [5], [6], [ar] [v]".

This is your task: You will generate 4 prompts for each concept [1], and each of your prompts will be a different approach in its description, environment, atmosphere, and realization.

Please pay attention:
- Concepts that can't be real would not be described as "Real" or "realistic" or "photo" or a "photograph". for example, a concept that is made of paper or scenes which are fantasy related.
- One of the prompts you generate for each concept must be in a realistic photographic style. you should also choose a lens type and size for it. Don't choose an artist for the realistic photography prompts.
- Separate the different prompts with two new lines

那么这个提示实际的效果是什么样子的呢?

在实践中,你可以在生成自己的提示时,通过添加、删除和改变现有开源提示的部分来缩短优化的时间。

相关推荐
Vex2une4 小时前
Windows 12 新功能展望:AI 深度融合、全新界面与下一代生产力体验
人工智能·windows·copilot·winui·新功能·ai pc
知几蜗牛5 小时前
Python Responses API函数调用实战:工具白名单、参数校验与预算
人工智能
知几蜗牛5 小时前
Gemini 4 Argon的1M输出窗口与长程Agent工程边界
人工智能
猎头南楼5 小时前
空调/家电嵌入式软件架构设计与 AI 辅助开发实践
人工智能
知几蜗牛5 小时前
Java 17调用gpt-transcribe实现会议录音转写与术语提示
人工智能
海盗12345 小时前
AI 新闻日报 2026-10-02:Claude Code 开放 Mods、13 自由度直驱灵巧手同日双发、代码评审成新瓶颈
人工智能·机器人·aigc
nhdh5 小时前
模型三剑客:工具、函数调用与MCP协同之道
人工智能·springai·智能客服、知识库问答
天国梦5 小时前
英语听说教学三大痛点与AI解决方案:从课堂困境到落地成效
人工智能
西索斯coding5 小时前
grok-4.7 调用一直 429 怎么办?不是额度用完——是 RPM 和 TPM 双桶限流,附响应头读取代码和退避策略
大数据·人工智能·机器学习·ai
ccstuck5 小时前
AI安全系列:给最小 Agent 做提示注入测试
人工智能·安全·ai安全