Skip to main content
System prompts set the context and behavior for your AI model. Use them to create specialized assistants, enforce response formats, or constrain the model’s persona.

Basic Usage

Common Patterns

Coding Assistant

Customer Support Bot

JSON Output

Character/Persona

Tips for Effective System Prompts

Vague prompts lead to inconsistent results. Specify exactly what you want: ❌ “Be helpful” ✅ “Provide step-by-step instructions. Use bullet points. Keep each step under 20 words.”
Show the model what you expect: Format responses like this example: Q: What is 2+2? A: **4** — Two plus two equals four.
Tell the model what NOT to do: - Do not provide medical advice - Do not generate harmful content - If asked about topics outside your expertise, politely decline
Shorter prompts use fewer tokens and leave more room for generation: ❌ Long, rambling instructions with repetition ✅ Clear, bullet-pointed rules

Reusable Prompt Class

Create a helper class for managing prompts:

See Also

generate()

Full generation API

Best Practices

Optimization tips