AI engineering

Stage 2 of 8 · 9 lessons · ~5 weeks

Prompting and model APIs

Treat prompts as code and model calls as an unreliable network dependency. Be specific, fix the output format and show examples, then learn one provider's API properly: system prompts, streaming, retries and a local model for cheap experiments.

Start: The chat messages API

Lessons· one lesson for each topic, in this order

  1. 1The chat messages API
  2. 2Specific instructions and output format
  3. 3System prompts
  4. 4Few-shot examples
  5. 5Prompts in version control
  6. 6Streaming responses
  7. 7Timeouts, retries and backoff
  8. 8Hosted vs local models
  9. 9Open-weight models and where to run themOptional

Start with· follow one of these

Practise

  • Run open models locally to test prompts and sampling settings at zero API cost

Keep handy

Also worth your time

Before moving on: Build a small Python command-line tool that turns messy text, such as a job post or an email thread, into a fixed output format with an official provider SDK, streams its reply, retries on timeouts, and runs against both a hosted model and a local one through Ollama.

Tauseef's advice
Get a plain prompt with clear instructions, a fixed output format and two or three examples working before you reach for tools or frameworks; most weak outputs come from vague prompts, not weak models. Keep prompts in Git and rerun them on the same ten inputs every time you change a word.

Mark this stage as not done?