How do you control output length?
Prompt Engineering Patterns: Instruction Following, Negative Constraints, and Output Format Control
Audio flashcard · 0:21Nortren·
How do you control output length?
0:21
Control length by giving specific numerical targets like "respond in 100 words" or "use exactly five bullet points." Vague directions like "be brief" or "be detailed" produce inconsistent results. For absolute limits, also enforce them at the API level using max_tokens. Models respect length instructions better when the target is concrete and achievable for the task.
docs.anthropic.com