system message

A message with role "system" that sets instructions, persona, and constraints for the model before the conversation begins.

Syntax

openai-api
{ role: "system", content: "You are a..." }

Example

openai-api
const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [
    { role: "system", content: "You are a senior Python developer. Respond only with code and concise explanations. Always use type hints." },
    { role: "user", content: "Write a function to parse a CSV file" }
  ]
});