Skip to main content

Prompt

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/prompt

In short

A prompt is the input text or instructions you give an AI model, such as an LLM, to tell it what task to perform and what kind of answer you want.

What is a prompt?

A prompt is everything you send to a language model before it starts generating a response. It can be a simple question, a detailed set of instructions, examples of the desired output, or pasted documents for the model to work with. The answer depends heavily on what the prompt contains and how clearly it is written.

Many AI APIs split a prompt into messages with different roles. A system prompt sets the overall behavior and rules, such as tone or output format, while user messages contain the actual requests. Including a few worked examples in the prompt is called few-shot prompting, while asking with no examples is called zero-shot prompting.

Writing a prompt is a lot like briefing a new colleague: the more context, constraints, and examples you give, the less they have to guess. Good prompts state the goal, provide relevant background, specify the output format (for example, JSON with certain fields), and say what to do when information is missing.

Prompt engineering is the practice of designing and testing prompts to get reliable results. It is different from training or fine-tuning: a prompt only changes the model's behavior for that request and does not change the model itself.

At a glance

A prompt is everything the model reads: instructions about its role and rules, context such as documents or examples, and the question itself; the language model reads them as one text and writes an answer shaped by every part.the promptInstructionsrole · tone · rulesContextdocuments · examplesQuestionwhat you want nowLLMpredicts textreads it all as one textAnswershaped by every part
Clear instructions and good context matter as much as the question itself.

Key takeaways

  • A prompt is the input that tells an AI model what to do.
  • System prompts set the rules; user prompts carry the specific request.
  • Clear instructions, context, and examples lead to better answers.
  • A prompt affects a single request and does not retrain the model.

Example

A structured prompt with system and user messagesjavascript
// Rules go in the system message, the actual task in the user message
const messages = [
  {
    role: "system",
    content: "You are a code reviewer. Reply in JSON with the fields 'issues' and 'summary'.",
  },
  {
    role: "user",
    content: "Review this function: function add(a, b) { return a - b; }",
  },
];

// Send the whole prompt to the model (callModel is a placeholder)
const reply = await callModel(messages);

Readers ask

What is prompt engineering?

Prompt engineering is the practice of writing, testing, and refining prompts so an AI model produces accurate, consistent, and useful output. It includes techniques such as giving clear instructions, adding examples, and requiring a specific output format.

What is a system prompt?

A system prompt is a special instruction, usually hidden from the end user, that sets the model's role, rules, and style for a whole conversation. User messages then add specific requests on top of it.

What is prompt injection?

Prompt injection is an attack where untrusted text, such as a web page or user input, contains instructions that trick the model into ignoring its original rules. It is similar in spirit to SQL injection, so applications should treat any outside text sent to a model as untrusted.

See also

Free · once a week

Software and AI, explained once a week

The week's software and AI news with every term explained, plus a term to learn and a quick quiz. A two-minute read.

You confirm by email first, and one click unsubscribes. Privacy

See this week's issue

About this page

Page history

  1. Added a diagram: the parts of a prompt and the answer they shape.

Changes that altered what this page says. Typo fixes are not listed.

Spotted a mistake or something missing on this page?Suggest an edit

How pages are made

More

Settings