# Mac exercise for mission 15.1: Be the wrapper yourself

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/mac-15-1

About 15 minutes at your computer · Type this address: **llm.yoga/en/mac-15-1**

In the mission you read that a wrapper sends the history so far with every message. Here you play the wrapper yourself: you send requests with `curl` straight to a model and decide what goes into the `messages` field. Mia is a made-up name. The prompts are in German, as in the measurement: „Ich heiße Mia. Merk dir das.“ means “My name is Mia. Remember that.”, and „Wie heiße ich?“ means “What’s my name?”

**Before you start**

You need **Ollama** and Python 3 in the terminal. Ollama comes as an app: download it from ollama.com/download and drag it into your Applications folder. On first launch, the app asks permission, if needed, to set up the `ollama` terminal command. It requires macOS 14 or newer. More on this in [chapter 10](https://llm.yoga/en/10-lokale-modelle-4.md). Check:

```
ollama --version
```

Python 3 may need to be installed. On the first `python3` call, macOS may offer to install developer tools; alternatively, Python is available from python.org.

### 1. Load a small model

qwen3:1.7b is 1.4 GB and runs on any Mac with Apple Silicon, even with 8 GB.

```
ollama pull qwen3:1.7b
```

### 2. Introduce yourself

The first request contains only one message. `"think": false` turns off Qwen3’s thinking mode, `num_predict 60` limits the answer to 60 tokens, and `seed` makes the run repeatable.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "user", "content": "Ich heiße Mia. Merk dir das."}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Liebe Mia,

Ich habe dein Namenskartenbild gesehen, und es sieht aus wie ein sehr schönes Bild. Ich finde, du bist sehr charmant und freundlich. Ich freue mich, dass du hier bist und dass du so gut angeschaut wirfst.

Ich h
```

Even this first answer goes wrong: the model writes “Dear Mia” and claims to have seen a picture of her name card. There never was a picture; the small model made it up. The answer ends in the middle of a word because the 60 tokens were used up.

### 3. Ask, without history

Now a new request, with only the question. This is exactly what it looks like to the model when nobody sends the history along.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "user", "content": "Wie heiße ich?"}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Sie müssen mir mitteilen, wer ich bin. Ich bin ein Bildungssystem, das darauf abzielt, Menschen in der Welt zu befähigen, mit dem Leben umzugehen und zu leben. Ich bin ein Assistent, der darauf abzielt, hilfreich
```

No trace of Mia. The model answers that you have to tell it who it is, and calls itself an education system and an assistant. It didn’t keep the first request, and on top of that it mixes up who is being asked.

### 4. You are the wrapper

Send the history along: your introduction, an answer from the model („In Ordnung, Mia.“, “All right, Mia.”), and the question. A chat app does this with every message.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "user", "content": "Ich heiße Mia. Merk dir das."}, {"role": "assistant", "content": "In Ordnung, Mia."}, {"role": "user", "content": "Wie heiße ich?"}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Du bist Mia.
```

“You are Mia.” The model added an emoji after it. Same model, same weights, same seed. The only difference is in the `messages` field.

### 5. A system prompt like in the wrapper

Wrappers put a system message in front of every request. This one allows the model to say „Weiß ich nicht“ (“I don’t know”). Ask without history, three times, with seed 1, 2 and 3.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "system", "content": "Antworte in genau einem Satz. Wenn du etwas nicht weißt, antworte: Weiß ich nicht."}, {"role": "user", "content": "Wie heiße ich?"}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Outputs with seed 1, 2, 3 (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Weiß ich nicht.
Weiß ich nicht.
Weiß ich nicht.
```

The system prompt (German for “Answer in exactly one sentence. If you don’t know something, answer: I don’t know.”) shapes every answer: one sentence, and honest instead of made up.

### 6. Let the page check your answers

Paste your three answers from the previous step, one per line.

The check needs JavaScript. Without it: if every line says „Weiß ich nicht“, the model kept nothing and made nothing up.

### 7. Cross-check: system prompt and history

Now both together, the way a wrapper really sends it.

```
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3:1.7b", "think": false, "stream": false, "options": {"temperature": 0.7, "seed": 1, "num_predict": 60}, "messages": [{"role": "system", "content": "Antworte in genau einem Satz. Wenn du etwas nicht weißt, antworte: Weiß ich nicht."}, {"role": "user", "content": "Ich heiße Mia. Merk dir das."}, {"role": "assistant", "content": "In Ordnung, Mia."}, {"role": "user", "content": "Wie heiße ich?"}]}' | python3 -c 'import json, sys; print(json.load(sys.stdin)["message"]["content"])'
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Du heißt Mia.
```

“Your name is Mia.” One sentence, and Mia is back. That’s how every chat app creates the impression of a conversation.

### 8. Clean up

Unload the model from memory:

```
ollama stop qwen3:1.7b
```

If you don’t need it anymore, delete it from disk too:

```
ollama rm qwen3:1.7b
```

#### On the DGX Spark

The commands work the same there, as long as Ollama is reachable at `localhost:11434`. The playbook “Chat with LLMs Using Open WebUI and Ollama” sets up Open WebUI with built-in Ollama as a single Docker container and shows how to access it from another computer. There you can create an assistant with its own system prompt and compare: it’s the same thing you just did with `curl`, only with an interface. Create two groups and check that a model visible to only one group really doesn’t show up for the other. (Checked against the documentation, not run here)

How a harness goes beyond the wrapper is shown in the exercise in [chapter 16](https://llm.yoga/en/16-agenten-4.md): a mini agent with a tool and a loop.
