返回 AiToEarn
1 # Prompting best practices
2
3 Prompt structure, specificity, and iteration for `generate_image`.
4 Pick `model`, `size`, `quality`, and `style` from `list_image_models`. Do not invent those values here. When the user has no model preference, prefer `gpt-image-2.5-sunburst` if the catalog lists it.
5
6 Copy/paste recipes: `references/sample-prompts.md`.
7
8 ## Structure
9
10 - Order: scene/backdrop -> subject -> key details -> constraints -> output intent.
11 - Include intended use (ad, UI mock, infographic) to set polish.
12 - For complex requests, use short labeled lines instead of one long paragraph.
13 - When the user names a target device, format, or aspect (landscape/portrait, poster, phone screen), say so in the prompt and pick a matching `size` from the model catalog.
14
15 ## Specificity policy
16
17 - If the user prompt is already specific, normalize it. Do not add creative requirements.
18 - If the prompt is generic, add tasteful detail only when it materially improves the output.
19 - Treat `sample-prompts.md` as fully-authored recipes, not the default amount of augmentation.
20 - For photorealism, include `photorealistic` plus real texture: pores, wrinkles, fabric wear, material grain, everyday imperfect detail.
21
22 ## Allowed and disallowed augmentation
23
24 Allowed for generic prompts:
25
26 - composition and framing cues
27 - intended-use or polish-level hints
28 - practical layout guidance
29 - reasonable scene concreteness that supports the request
30
31 Do not add:
32
33 - extra characters, props, or objects that are not implied
34 - brand palettes, slogans, or story beats that are not implied
35 - arbitrary side-specific placement unless the surrounding layout supports it
36
37 ## Composition and layout
38
39 - Specify framing and viewpoint only when it materially helps.
40 - Call out negative space if the asset needs room for UI or copy.
41 - Avoid left/right layout decisions unless the user or surrounding layout supports them.
42 - For people, describe body framing, scale, gaze, and object interactions when they matter.
43
44 ## Constraints and invariants
45
46 - State what must not change (`keep background unchanged`).
47 - For edits: `change only X; keep Y unchanged`. Repeat invariants on every iteration.
48
49 ## Text in images
50
51 - Put literal text in quotes or ALL CAPS. Specify typography, size, color, and placement.
52 - Spell uncommon words letter-by-letter if accuracy matters.
53 - Require verbatim rendering and no extra characters.
54 - Prefer a catalog quality meant for dense text when the model exposes quality options.
55
56 ## Input images and references
57
58 - Images the user provided with the request must be passed in `generate_image.images`. Silently ignoring them and generating from scratch is a failure mode; only skip them when the user explicitly says they are irrelevant or inspiration-only.
59 - Inspect each provided image first and describe what is actually in it — subject, visible text and its language, colors, layout. Do not replace its real content with invented content.
60 - Do not assume every provided image is an edit target.
61 - Label each image by index and role (`Image 1: edit target`, `Image 2: style reference`, `Image 1: adaptation base`).
62 - Grounded redesign/adaptation: preserve the image's real content — original text, language, palette, key layout — and prompt only the requested change; list preserved items as constraints/invariants.
63 - Style/composition/mood references without a request to modify them → generation with `images`.
64 - Preserve an existing image while changing specific parts → edit with `images`.
65 - For compositing, describe how the images interact (`place the subject from Image 2 into Image 1`).
66 - Pass image URLs in `generate_image.images`. Stay within `maxInputImages`.
67
68 ## Iterate deliberately
69
70 - Start with a clean base prompt, then make small single-change edits.
71 - Re-specify critical constraints when you iterate.
72 - Prefer one targeted follow-up over rewriting the whole prompt.
73
74 ## Transparent images
75
76 There is no alpha or local cutout tool. If the user wants a cutout, prompt a flat solid chroma-key background (`#00ff00`, or `#ff00ff` for green subjects), forbid shadows/gradients/floor/reflections, and tell the user the result is a keyed image URL.
77
78 ## Use-case tips
79
80 Generate:
81
82 - photorealistic-natural: photography language; real texture; avoid over-stylized polish unless requested.
83 - product-mockup: product/packaging and materials; clean silhouette; verbatim labels if text is required.
84 - ui-mockup: state fidelity first (shippable mockup or low-fi wireframe); layout and hierarchy, not concept art.
85 - infographic-diagram: audience, layout flow, explicit labels, verbatim text.
86 - logo-brand: simple, scalable, strong silhouette, balanced negative space.
87 - ads-marketing: creative brief — brand position, audience, vibe, scene, exact tagline.
88 - productivity-visual: name the artifact, canvas, hierarchy, real labels/data, readable type.
89 - scientific-educational: audience, lesson objective, required labels, scientific constraints.
90 - illustration-story: panels or scene beats; keep each action concrete.
91 - stylized-concept: style cues, material finish, rendering approach; do not invent story.
92 - historical-scene: location/date and period accuracy; constrain clothing, props, environment.
93
94 Edit:
95
96 - text-localization: change only the text; preserve layout and typography.
97 - identity-preserve: lock face, body, pose, hair, expression; change only the specified elements.
98 - precise-object-edit: specify exactly what to remove/replace; keep everything else unchanged.
99 - lighting-weather: change only light, atmosphere, weather; keep geometry and identity.
100 - background-extraction: flat chroma-key background; crisp silhouette; generous padding; no restyling.
101 - style-transfer: preserve palette/texture/brushwork; add `no extra elements`.
102 - compositing: reference inputs by index; match lighting, perspective, and scale.
103 - sketch-to-render: preserve layout, proportions, and perspective; do not add new elements.
104
104 lines MARKDOWN