LLM 101

A concept lab for engineers: how LLM applications work from prompt to reply. Offline-first Python exercises with pytest. No API key required for the core path.

What you will learn

  1. Tokens and the loop – context grows one token at a time; stop conditions matter.
  2. Fake inference – a deterministic FakeLLM with the same complete() shape as a live client.
  3. Tool catalogue – the model proposes calls; your app validates and executes them.
  4. RAG – retrieve docs, pack them into the prompt, then answer.
  5. Eval harness – fixed cases and checkers; pytest is the regression suite.
  6. Optional live API – same interface via OpenAI when OPENAI_API_KEY is set (skipped in CI otherwise).

Quick start

git clone https://github.com/iammikek/llm-101.git
cd llm-101
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
pytest

Core tests pass with no secrets. Design rule: the model never executes tools; the lab Agent does.