System prompts and settings

How to give a model standing instructions, and what the main settings change.

When you build with an AI model, you get some controls that a regular chat window hides. The two big ones are the system prompt and a handful of settings.

The system prompt

In the last lesson you met the "system" role. The system prompt is that message: standing instructions that you, the builder, write once. The model treats it as the ground rules for the whole conversation, no matter what the user types.

A good system prompt uses the same skills as any good prompt. Give the model a role, a job, and clear limits. For example:

"You help customers of a bike shop. Answer questions about repairs and bookings. Keep replies under 100 words. If someone asks about prices, say a staff member will confirm."

That is far more useful than "Be helpful." The model knows who it is talking to, what to cover, how long to be, and what to avoid.

Keep in mind that a system prompt guides the model. It is not a lock. A user can sometimes talk a model into ignoring its instructions, so don't rely on the prompt alone to stop anything serious.

Temperature: how much it varies

Temperature is a number that controls randomness. Remember that a model picks each next word from a range of likely options.

  • Low temperature makes it stick to the most likely choices. Replies are steadier and more alike each time.
  • High temperature lets it pick less likely options more often. Replies vary more and can feel more creative, but they also drift off topic more easily.

For pulling facts out of a document, go low. For brainstorming names for a bake sale, a bit higher can help. The exact range of numbers differs by provider, so check the docs.

Maximum output length

You can also cap how long a reply may be, measured in tokens. This keeps costs down and stops rambling. The trade-off: if the cap is too small, the reply simply stops, sometimes mid-sentence. If you see cut-off answers, this setting is the first place to look.

Finding the balance

There is rarely one right setting. A longer, more detailed system prompt gives better guidance but adds tokens to every request, which adds cost. A higher temperature adds variety but less control. Start simple, test with real examples, and change one thing at a time so you can tell what made the difference.

Try it

Write a system prompt for a helper you'd like to have, such as a recipe planner or a homework explainer. Include its job, who it talks to, how long its answers should be, and one thing it should not do.

Check your understanding

4 questions. Get 4 right to master this skill. Quiz results count toward your skill progress; they are not a credential.

  1. 1. What is a system prompt for?
  2. 2. You are building a tool that pulls dates out of invoices. Which temperature makes the most sense?
  3. 3. Your app's replies keep stopping mid-sentence. What setting is the likely cause?
  4. 4. Which system prompt is likely to work better for a support helper at a bike shop?

0 of 4 answered.

What this opens up

Back to the AI Foundations tree