Define model behavior
You need consistent behavior, tone, or output constraints across requests.
AI & ML · Const
Prompt engineering designs model instructions and inputs to produce responses that consistently satisfy requirements. Use clear guidance, context, examples, evaluations, and versioned deployment practices to improve reliability.
Prompt engineering is the deliberate design of model instructions and inputs so responses consistently satisfy a task. You improve prompts by stating the goal clearly, supplying needed context or examples, testing behavior with representative evaluations, and versioning changes as part of deployment.
client.responses.create({ model, instructions, input })| Name | Type | Description |
|---|---|---|
instructions | string | High-level behavioral instructions, including tone, goals, and examples of correct responses. |
input | string | The task prompt or user input to process. |
A model-generated response whose content is evaluated against the prompt's intended requirements.
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-5",
instructions="You are a concise technical tutor. Explain concepts with one example.",
input="Explain prompt engineering in two sentences."
)
print(response.output_text)This runnable example separates high-level behavior from the task input when calling the Responses API.
You need consistent behavior, tone, or output constraints across requests.
You are iterating on a prompt and need evidence that a change improves results.
You are releasing prompt changes to a production application.
Prompt engineering is writing effective model instructions so the generated content consistently meets requirements. Since generation is non-deterministic, the process combines deliberate design with empirical testing.
Follow-up: How would you make prompt behavior safer to change? Add representative fixtures, tests, and evaluation checks, then roll changes out through the deployment system with staged controls when needed.
The Responses API separates high-level behavior in instructions from the task supplied in input. The documentation states that instructions have higher priority than a prompt in input.
Follow-up: What should be tested when changing instructions? Test representative inputs and expected properties, then compare evaluation results before and after the change.
A production prompt should be versioned like application code: keep it in the deployment path, test it against representative fixtures, and evaluate its behavior before release. Pinning model snapshots also helps maintain consistent behavior while prompts evolve.
Follow-up: What if the model version changes? Re-run the evaluation suite against the new snapshot and review any behavior differences before promotion.
message rolesResponses APImodel snapshotsevaluation suitesreusable promptsPlaygroundEvals API