Training material on generative AI, large language models and AI assistants
Table of Contentsdōjō (道場, Japanese) - a place for immersive learning. Literally, a place to learn the path (dō).
The AI Dojo is a place for learning about AI and data science through Jupyter notebooks: introductory material, code demos, and interactive coding exercises. This repository contains a course on generative AI.
Generative AI: from how language models work to building your own AI assistants. Run proprietary and open LLMs, build Python applications with Retrieval-Augmented Generation (RAG), structured outputs and tool use, and work with vision and speech models.
- Level: Intermediate
- Prerequisites: Python programming; basics of deep learning are helpful
- Start here: 📓 Course agenda
This project uses uv to manage Python and the dependencies.
macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"In the repository directory, run:
uv syncThis creates a virtual environment in .venv with Python 3.12, all required packages, and the ai_dojo helper package that the notebooks import.
Without uv
With Python 3.10–3.12 installed:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .uv run jupyter labOpen notebooks/dojo.ipynb, and run notebooks/test.ipynb to check that everything works.
Most notebooks run open language models locally with Ollama. Install Ollama, start it, and pull a chat model and an embedding model to begin with:
ollama pull qwen3.5:4b
ollama pull nomic-embed-textEach notebook names the models it uses, so you can pull further models as you go. The courses use these models:
| Model | Used for |
|---|---|
tinyllama, qwen3.5:1.7b |
First steps with small models |
qwen3.5:4b, qwen3.5:9b, olmo-3:7b |
Chat, RAG, structured output, tool use, vision |
llama3:text, llama3:instruct |
Base model vs. chat model |
nomic-embed-text, mxbai-embed-large |
Text embeddings and RAG |
mixtral |
LlamaIndex example (large: skip it on a laptop) |
To use Ollama on another machine, set the environment variable OLLAMA_HOST, for example OLLAMA_HOST=http://my-server:11434 (see .env.example).
A few notebooks show proprietary model APIs, and need an API key:
lm-proprietary-api.ipynb: a Poe API key, entered when promptedlm-intro-llamaindex.ipynb: an Anthropic API key in the environment variableANTHROPIC_API_KEY, or entered when prompted
To chat with your Ollama models in a ChatGPT-style web interface, follow Hosting your own AI Chat App - with LibreChat and Ollama.
notebooks/
├── dojo.ipynb # table of contents
├── index/ # course index notebooks
├── ai/ # introduction to AI
├── language-models/ # language model notebooks
├── dl/ # deep learning background
├── .assets/data/ # datasets (see the README there)
└── test.ipynb # setup check
src/ai_dojo/ # helper package used by the notebooks
Notebooks are committed without outputs. To strip outputs automatically on commit, run once:
uv run nbstripout --installExcept where otherwise noted, the training material in this repository is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license, see LICENSE. Third-party figures are credited in their captions. For the sources and licenses of the datasets, see notebooks/.assets/data/README.md.
The ai_dojo Python package in src/ai_dojo/ is licensed under the MIT License.
