Generative AI

Prompt

A prompt is the text sent to a generative AI model to get a response, including the instructions, the question, any supplied documents or examples, and the required output format.

What is a prompt?

A prompt is the input sent to a generative AI model to produce a response. For a language model it is text, and it can be a single question or several pages that combine instructions, background facts, retrieved documents, worked examples, and a description of the output format. For an image model it is a description of the picture to render. Everything the model knows about the task at hand, beyond what it learned in training, arrives through the prompt.

In a deployed application the prompt a user types is only one part of what the model receives. The application adds a system prompt that sets the role and rules, inserts retrieved passages, and may wrap the user’s words in a prompt template. The whole package must fit in the model’s context window, which is measured in tokens.

How a prompt works

The model reads the entire prompt and generates a continuation, one token at a time, that is most consistent with it. Clear structure helps: a stated role, explicit instructions, the material to work on set apart with labels or delimiters, and a precise description of the desired output. Vague prompts produce generic answers because the model fills every gap with the most common interpretation. The practice of writing prompts that reliably produce the intended output is prompt engineering.

Prompts in practice

An operations manager at a parts distributor wants a daily summary of late purchase orders. A first prompt, “summarize these late POs”, returns a paragraph of prose. A revised prompt states the role (a purchasing analyst), the audience (the operations manager), the required format (a table of supplier, PO number, days late, and order value, sorted by value), and the rule to flag any supplier with three or more late orders. The second prompt produces the same useful output every morning, and it becomes a prompt template fed by the ERP export.

What to watch for

  • Any text placed in the prompt is treated as potential instruction, including the contents of retrieved documents, which is the opening for prompt injection.
  • Longer prompts cost more and respond more slowly, so include the documents the task needs and leave out the rest.
  • Prompts that work on one model may behave differently on another, so keep a test set and re-run it after any model change.
  • Store production prompts in version control alongside the application code, since a prompt edit changes behavior as much as a code change.

← Back to AI Glossary