Skip to main content
System prompts define the AI’s personality, behavior, and constraints. They’re processed before the user’s prompt and help ensure consistent responses.

Basic Usage

How System Prompts Work

The system prompt is prepended to your conversation, establishing context for the model:

Examples

Customer Support Bot

Code Assistant

Creative Writer

JSON Output

Language Tutor

Best Practices

Be Specific

Set Boundaries

Control Output Format

Maintain Persona

Reusable System Prompts

Create a library of system prompts for different use cases:

Tips

Long system prompts consume context window tokens. Be specific but brief.
Small changes in wording can significantly affect output. Test different phrasings.
Use temperature: 0.3-0.5 when you need the model to strictly follow format instructions.
Use stopSequences to prevent the model from generating beyond your desired format.

generate()

Learn more about generation options →