BeginnerCoder

Lesson 3 — Prompts and system messages

Telling the model how to behave

A prompt is the text you send to a model. The system message is a special prompt that goes first and sets the rules: tone, length, format, what the model is allowed to do. The user message is the actual question.

[{"role": "system", "content": "Reply in uppercase."},
 {"role": "user", "content": "Tell me about Python"}]

Same question, different system message → different answer. Our fake_llm copies this: it reads the rules from messages[0] and changes its reply.

Why it matters: the system message is the main way you shape an agent's behaviour. You will write one for every agent you build.

Tip: keep system messages short and specific — "Reply in under 20 words" works better than "be brief-ish".

Want it another way?
Task

Make make_messages() return two dicts: a "system" message with system_prompt, then a "user" message with user_text.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.