Bilingual (English / 中文) course on building applications with foundation models, based on Chip Huyen's AI Engineering: Building Applications with Foundation Models (O'Reilly, 2025).
10 lessons, 2 hours each (1 hour concept + 1 hour hands-on).
| Track | Material | Who it's for |
|---|---|---|
| Concept | AI_Engineering_10_Lesson_Course_EN.md / AI工程化十节课教程_中文版.md |
anyone, no coding — web tools only (ChatGPT / Poe / AI Studio) |
| Code | the .ipynb notebooks |
some technical comfort required — see below |
The tracks complement each other; neither is a translation of the other. Concept track builds intuition, code track makes the same ideas reproducible and editable.
Concept track: none. Everything runs in a browser with free tools.
Code track: you don't have to write Python, but you can't avoid touching it. To get through the notebooks you need to be comfortable with:
- running commands in a terminal (the Quick start block below)
- getting an API key from a provider dashboard, or installing Ollama
- opening Jupyter and running cells in order
- editing values inside a Python dict — e.g. changing
PROVIDER, or filling in your own scores in Lesson 4 - reading an error message and matching it against the Troubleshooting table
No lesson asks you to write a function from scratch, and no prior Python is assumed. But "no programming background at all" is optimistic for this track — a complete beginner should either pair with someone technical for setup, or do the concept track first and come back.
If the terminal is the blocker, an instructor can set the environment up once and hand out a ready-to-run machine or a hosted notebook. From there the course is mostly run the cell, read the output, change one value, run it again.
# 1. Environment (already created in .venv/ — recreate with these two lines if needed)
uv venv .venv --python 3.13
uv pip install --python .venv/bin/python -r requirements.txt
# 2. Register the Jupyter kernel
.venv/bin/python -m ipykernel install --user --name aie --display-name "AIE Course (.venv)"
# 3. Add your key
cat > .env <<'KEY'
OPENAI_API_KEY=sk-your-key-here
KEY
# 4. Launch
source .venv/bin/activate
jupyter labIn VS Code or an existing Jupyter, just pick the kernel AIE Course (.venv).
Start with 00_Environment_Setup.ipynb — it tests connectivity to
every provider and tells you which ones your keys can reach.
Every lesson notebook opens with the same config cell. Change one line to switch:
PROVIDER = 'openai' # 'openai' / 'deepseek' / 'openrouter' / 'ollama'| PROVIDER | Key in .env |
Small / big model | Embeddings (Lesson 6) |
|---|---|---|---|
openai |
OPENAI_API_KEY |
gpt-5.6-luna / gpt-5.6-terra |
✅ text-embedding-3-small |
deepseek |
DEEPSEEK_API_KEY |
deepseek-v4-flash / deepseek-v4-pro |
❌ falls back to a local bag-of-words vector |
openrouter |
OPENROUTER_API_KEY |
openai/gpt-5.6-luna / openai/gpt-5.6-terra |
❌ same fallback |
ollama |
none (local, free) | gemma4:e2b-mlx — or any model you pull |
✅ nomic-embed-text (pull it first) |
All four speak the OpenAI API format, so no other code changes. The rest of each notebook only
uses MODEL, MODEL_BIG, and EMBEDDING_MODEL.
Running all ten notebooks costs roughly $0.10 on OpenAI pricing. DeepSeek is cheaper; Ollama is free.
ollama serve
ollama pull gemma4:e2b-mlx # ~6.5GB, MLX build for Apple Silicon
ollama pull nomic-embed-text # ~275MB, only needed for Lesson 6Then set PROVIDER = 'ollama'.
gemma4:e2b-mlx is only the proof of concept — use any local model your machine can handle.
It is a small 2B model chosen to show that the notebooks run end-to-end with zero API spend. It
does run every cell, but answer quality is well below the cloud models, and it shows most in the
evaluation and judging lessons. A bigger local model makes those lessons noticeably better.
To swap it, pull whatever you like from ollama.com/library and put
that name in the ollama block of the config cell:
'ollama': {
'model': 'your-model-here', # e.g. a 7B/8B chat model
'model_big': 'your-bigger-model', # can be the same name if you only have one
...
}Rough sizing — a 4-bit quantized model needs about 1GB of RAM/VRAM per billion parameters, plus a couple of GB of headroom:
| Your machine | Practical model size |
|---|---|
| 8GB RAM | 2–3B |
| 16GB RAM | 7–8B |
| 32GB RAM | 13–14B, or a small MoE |
| 64GB+ RAM / dedicated GPU | 30B+ — closest to cloud quality |
Setting model and model_big to two different local models also makes Lesson 4 (model
comparison) and Lesson 9 (small vs. big latency) meaningful again; with one model both sides of
those comparisons are identical.
On Apple Silicon, -mlx builds run through Apple's MLX framework and are faster than the generic
GGUF builds. On other hardware just drop the suffix.
00_Environment_Setup.ipynb provider connectivity check — run this first
EN_Lesson_XX_*.ipynb code track, English
Lesson_XX_*.ipynb code track, 中文
AI_Engineering_10_Lesson_Course_EN.md concept track, English
AI工程化十节课教程_中文版.md concept track, 中文
assets/ images used by this README
requirements.txt shared dependencies
.env your API keys (git-ignored, never commit)
| Symptom | Fix |
|---|---|
no API key found for <provider> |
.env missing, or the key name doesn't match the table above |
| Lesson 6 prints a bag-of-words warning | provider has no embeddings endpoint — switch to openai, or ollama + nomic-embed-text |
model "..." not found, try pulling it first |
ollama pull <model> |
Kernel has no openai module |
wrong kernel selected — pick AIE Course (.venv) |
- Keys live in
.envonly;.gitignorealready excludes it. Never commit a key. - Model IDs and prices drift. Verify against the provider's pricing page before teaching Lesson 9, which quotes per-million-token rates.
