Skip to main content
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 the StructuredOutput module:

Best Practices

Keep system prompts concise. Longer system prompts consume more of the model’s context window, leaving less room for the user’s prompt and the response.
  • 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

Generate

Full generation with options

Streaming

Real-time token streaming