Step 1 · The model cannot know
What this step adds: your first model call from Python — and proof of the problem every agent exists to solve.
The new idea
Section titled “The new idea”A message is one turn in a conversation, written as a dictionary with two keys: role (who is speaking) and content (what they said). A conversation is a list of messages, and you send the whole list on every call.
The code
Section titled “The code”Create step1.py and type this in:
import ollama
question = "What was the amount of transaction T-1002, and which country was it in?"
response = ollama.chat( model="qwen2.5:3b", messages=[ {"role": "user", "content": question}, ],)
print("ASKED:")print(question)print()print("MODEL SAID:")print(response.message.content)Run it
Section titled “Run it”uv run step1.pyYou’re asking about transaction T-1002 — a transaction that exists only in this course’s fake data, which the model has never seen.
Expect one of two behaviours, and both are the lesson:
- The model says it doesn’t have access to transaction data. Honest.
- The model makes up an answer — an amount, a country, delivered in confident prose. This is called a hallucination: the model predicting plausible-sounding text where knowledge should be.
Run it three or four times. You may get both behaviours from the same model.
Why this happened
Section titled “Why this happened”A language model is a text predictor with frozen training data. It cannot look anything up. It doesn’t have your transactions, today’s date, or your database — and crucially, it doesn’t know that it doesn’t know. Nothing in the machinery distinguishes “recalling something from training” from “generating something plausible.”
That’s the problem statement for this entire course. The model brings reasoning and language; it cannot bring facts about your world.
What’s still wrong
Section titled “What’s still wrong”The model can’t answer questions about data it doesn’t have — and right now it has no way to get any. In the next step you build the thing that fixes that, and it’s nothing more exotic than a Python function.