What is Prompt?

Prompt is the complete input context supplied to a generative AI model for one inference request, combining applicable instructions, user data, conversation state, examples, tool definitions, and output requirements.

Quick Facts

Full NameAI Prompt
CreatedConcept emerged with GPT-3 (2020), formalized with ChatGPT (2022)
SpecificationOfficial Specification

How It Works

Prompt, message, template, and system prompt

A message is one role-tagged contribution to a conversation. A prompt template is reusable source text with runtime variables. A system prompt is one higher-authority instruction layer in APIs that support it. The effective prompt is the assembled request presented to the model, which can include all of these plus conversation history, retrieved passages, images, tool schemas, and generation settings. Keeping these concepts separate makes failures reproducible: a bad answer may come from the template, inserted data, retrieval, role ordering, or model configuration rather than the user's message alone.

An explicit request contract

A production prompt should state the objective, relevant context, constraints, expected output, and behavior for missing or conflicting information. Few-shot examples are useful when the task contains subtle labels or formatting conventions, but examples must agree with the written rules. Delimiters help the model distinguish instructions from data; they do not turn untrusted content into trusted instructions. When a task requires several unrelated decisions, split it into stages so each stage has a clear input and acceptance criterion.

Evaluation before stylistic iteration

Prompt engineering is test-driven iteration, not a search for magic wording. Start with representative tasks and explicit graders, record the prompt version, model, parameters, retrieved context, and output, then compare candidate behavior with a baseline. Use deterministic checks for schemas and policy invariants, rubric or pairwise graders for open-ended quality, and human review for high-impact cases. A single attractive response cannot establish reliability because model outputs and upstream context can vary.

Security and capability boundaries

A prompt can influence behavior but cannot grant facts the model does not have, guarantee truth, or enforce authorization. Direct and indirect prompt injection can cause untrusted content to compete with application instructions. Treat model output as untrusted, enforce tool permissions and business rules in deterministic code, minimize exposed data, validate structured responses, and require approval for consequential actions. Asking a model to reveal hidden reasoning is also unnecessary; request concise evidence, assumptions, or verifiable intermediate results instead.

Key Characteristics

  • Represents the complete model input for a request, not only the latest user message
  • Can combine role-tagged instructions, context, examples, tools, and output constraints
  • Conditions probabilistic generation rather than guaranteeing one deterministic answer
  • Must define missing-data and conflict behavior for reliable application use
  • Should be versioned with the model, parameters, retrieval state, and evaluation results
  • Cannot replace authorization, validation, source verification, or other code-enforced controls

Common Use Cases

  1. Classifying support requests against a controlled label set and escalation policy
  2. Extracting typed fields from documents with explicit missing-value behavior
  3. Grounding answers in retrieved evidence while requiring source identifiers
  4. Generating or reviewing code against repository and output constraints
  5. Driving an agent step with bounded tools, state, and completion criteria

Example

loading...
Loading code...

Frequently Asked Questions

Is a prompt the same as a user message?

Not necessarily. A user message is one input with a user role. The effective prompt may also contain system or developer instructions, conversation history, retrieved documents, examples, tool schemas, images, and provider-generated formatting. Debugging only the visible user text can therefore miss the actual source of a failure.

What should a production prompt contain?

Include a specific objective, only the context needed for that objective, operational constraints, an output contract, and explicit behavior for missing or contradictory data. Add examples when they clarify edge cases. Record the template version, model, parameters, and retrieved context so the request can be reproduced and evaluated.

Does asking a model to think step by step always improve accuracy?

No. The effect depends on the model and task, and current reasoning models may work better without manually prescribing their internal reasoning process. Test the instruction against a representative evaluation set. For production output, request a concise rationale, cited evidence, or verifiable intermediate values instead of treating exposed reasoning as proof.

Can delimiters or a system prompt prevent prompt injection?

No. Delimiters clarify structure and higher-authority instructions can reduce accidental conflicts, but untrusted text can still influence model behavior. Limit tool privileges, isolate external content, validate outputs, enforce authorization in code, and require human approval for high-impact actions.

How do I know whether a prompt change is better?

Run the baseline and candidate on the same representative tasks, preferably with repeated trials when outputs vary. Grade deterministic requirements separately from semantic quality, compare aggregate results and important slices, inspect regressions, latency, and cost, and promote the change only when predefined release thresholds are met.

Related Tools

Related Terms

Related Articles