Early Beta — The Web SDK is in early beta. APIs may change between releases.
Overview
System prompts define the AI’s behavior, personality, and constraints. They’re prepended to every generation request and help ensure consistent, focused responses.Basic Usage
Examples
Coding Assistant
Concise Responder
JSON Output
Persona
System Prompt Tips
Structured Output with System Prompts
For type-safe JSON generation, combine system prompts with theStructuredOutput module:
Best Practices
- Be specific — “You are a Python expert” is better than “You are helpful”
- Set output format early — Place format instructions at the start of the system prompt
- Use examples — Show the model what good output looks like
- Set constraints — Tell the model what NOT to do (e.g., “Do not include disclaimers”)
- Keep it short — Every token in the system prompt reduces available context
Related
Generate
Full generation with options
Streaming
Real-time token streaming