Stop Sequences are strings that tell the AI "stop generating when you hit this text." Like a "stop sign" for generation. Example: AI generates list items "1. Item\n2. Item\n3. Item"—set stop sequence "\n\n" to stop at first double newline. Useful for extracting specific parts of output, preventing rambling, or structured generation. Most APIs support 1-4 stop sequences. Simple but powerful control mechanism.
Use stop sequences when you want AI to stop at a specific point: generating one list item (stop at "\n"), extracting first paragraph (stop at "\n\n"), preventing AI from adding commentary after answer, or structured templates (stop at "---"). Great for precise control without complex prompts. Common in code generation (stop at function end), data extraction, or dialogue systems.
Ai Vocabulary
Token that ends generation