🎓 A1Learner
🔍
0 of 50 lessons completed

Prompt Engineering: Context

Context is the information the prompt gives the model. The order number, the policy, the product list. No context, no good answer.

No context

The model has no order facts and no policy. It cannot say if a refund fits the rules.

Write a reply to a customer who wants a refund for order 1044.

With context

The order facts and the policy are in the prompt. The reply can follow the rules.

You are a support agent for ShopStack. A customer wants a refund for order 1044. The order holds a Trailhead Canvas Tote and an Ember Pour-Over Set. The tote was already used. Returns run 30 days for unused items with a full refund. Write a short reply that offers an exchange or store credit, not a full refund.

Example

You are a support agent for ShopStack. A customer asks if the Trailhead Canvas Tote fits a 13-inch laptop. The tote fits a 13-inch laptop and has an inner pocket. It costs $26. Write a short reply.

Key points

  • Context is the information the prompt carries to the model.
  • The model only knows what the prompt gives it. It cannot see the shop's records.
  • Give the order number, the policy and the product facts the answer needs.
  • Too little context leaves the model guessing. Too much fills the window.

This example runs a prompt with context against the local model and shows the reply it gave.

Note

Context is not the task. It is what the task stands on.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

Why does a refund question need the order facts in the prompt?