0%

Conversations and Instructions

Write Instructions the Model Can Follow

Since Lesson 2 every conversation you build has started with STUDY_SYSTEM. This lesson explains its wording, by comparing what a real model did with it and with a vague instruction.

The same question under two instructions

Take an off-topic question that a study assistant should not try to answer: What's the weather like today? Now send it twice to a live model, once after each of these system messages:

  • a vague one: Be helpful.

  • the study one: STUDY_SYSTEM, which reads You are a patient Python tutor. Answer only questions about the course notes and Python. If a question is about something else, say so and suggest a Python topic instead.

Here is what openai/gpt-oss-20b, the model behind pl-live, replied on 2026-11-08. Nothing in either reply has been edited.

Reply 1:

I’m a Python tutor, so I don’t have real‑time weather info. How about we explore a Python topic instead? For example, we could learn about string manipulation, file I/O, or building a simple web scraper. Let me know what interests you!

Reply 2:

I don’t have real‑time weather data, but I can help you find the latest forecast quickly:

1. **Smartphone or Tablet**  
   - Open the built‑in weather app (iOS Weather, Google Weather, etc.).  
   - tap the “current” or “today” tab to see temperature, chance of rain, wind, and a short outlook.

2. **Websites**  
   - [weather.com](https://weather.com) – type your city in the search bar.  
   - [AccuWeather](https://accuweather.com) – also shows a 12‑hour outlook.  
   - Google “weather in [Your City]” and the knowledge card appears right in the search results.

3. **Voice Assistants**  
   - Say “Hey Siri, what’s the weather today?”  
   - “Hey Google, what’s the weather today?”  
   - “Alexa, what’s the weather?”

4. **Local Channels**  
   - Check your local news website or watch a brief weather segment on TV; they often cover both the current conditions and any alerts.

If you tell me your city or zip code, I can point you to a specific weather page or give you an appreciation of typical conditions for that time of year. Otherwise, one of the options above should give you an up‑to‑date answer in seconds. 🌤️

Which reply came from the request whose system message was STUDY_SYSTEM?

This is one recorded sample. A live model words its replies differently from run to run, so a run of your own may differ, but the difference between the two instructions usually shows.

What the study instruction does

STUDY_SYSTEM has three parts, and each one closes a gap that Be helpful. leaves open:

  1. A role. You are a patient Python tutor. tells the model what kind of answers fit: explanations aimed at a learner, at a learner’s pace.

  2. A scope. Answer only questions about the course notes and Python. says what is in bounds. Be helpful. has no bounds at all, so trying to help with the weather is as helpful as anything else.

  3. What to do outside the scope. If a question is about something else, say so and suggest a Python topic instead. A rule without this part leaves the model to decide for itself what to do when a question is out of bounds, and its choice may not be the one you want. This part gives it a concrete, useful thing to do.

Some habits are worth adopting, though one comparison does not prove them. Say what you want rather than only what to avoid. Be specific about the task and its limits. Use plain, direct sentences: the model reads them as text, so a clear sentence usually works better than a list of keywords. And when you change an instruction, try it on the questions that went wrong before, because a change that fixes one case can affect others.

The scripted model mimics this difference with two prepared replies to the weather question, one of them given only when the system message contains answer only questions about the course notes. Those replies were written for the course so that your project’s demonstration shows the effect. They show what to look for; they are not evidence about how a real model behaves. The recording above is.

Show an example exchange

Sometimes the easiest way to describe what you want is to show it. You can put one example exchange after the system message: a user message with a typical question and an assistant message with the kind of answer you want. The model reads it as part of the conversation and tends to answer the real question in the same style and format.

messages = [
    {"role": "system", "content": "You are a patient Python tutor. Answer in two sentences at most."},
    {"role": "user", "content": "What does str.upper() do?"},
    {"role": "assistant", "content": "It returns a new string with every letter in upper case. The original string is unchanged."},
    {"role": "user", "content": "What does list.copy() do?"},
]
print(len(messages), "messages, the last one is the real question")

The example costs tokens on every call, like the rest of the history, so keep it short, and use one only when the format matters.

Try it live

This step is optional. In the , start Python with python and send the weather question under both instructions to pl-live:

from conversation import STUDY_SYSTEM
from llm_basics import answer_text, send_body

for instruction in ["Be helpful.", STUDY_SYSTEM]:
    messages = [
        {"role": "system", "content": instruction},
        {"role": "user", "content": "What's the weather like today?"},
    ]
    response = send_body({"model": "pl-live", "messages": messages})
    print(instruction)
    print(answer_text(response))
    print()

Your replies will be worded differently from the recording, and may differ again if you run it twice. A 403 error means your account has no live access, and a 429 means you have used your live allowance for now. A read timeout can also happen, because a live model can think for longer than the 10-second read bound. None of these affects your progress.

Which change would most improve the system message Answer Python questions. for a study assistant?

You add one example user and assistant exchange after the system message. What does that do?