All courses LLM apps

Build Your First LLM App in Python

Beginner

Call a model, get answers your code can trust, give it tools and stream the reply.

Beginner 9 lessons 29 lab exercises Certificate Updated

You build

A command-line program that reads a customer support message, files it as a validated category, priority and summary, looks up the order it mentions, and streams a draft reply.

You need

  • Python basics: functions, lists, dictionaries, handling errors and reading files (the course Python for AI from Zero is one way to get them). No experience with classes is needed: the few the course writes are explained as they appear.
  • Running commands in a terminal

To build it on your own machine

This is optional and comes with a plan. The course pack brings the starting files, a ready container and a check for every lesson. You need only Docker and git, plus your own AI coding agent if you want a tutor.

What you learn

From a first model call to a program whose answers your code can rely on

You build one small program from the first lesson to the last: a support ticket helper for the command line. It reads a customer message, files it as a validated category, priority and summary, looks up the order the customer mentions, and streams a draft reply. Each lesson adds one working part, and every part runs on recorded answers too, so you can check your work without a key. You already write basic Python; you need no experience with language models.

  • Talking to a Model. What a call to a language model really is: the request format most providers and local servers share, messages and their roles, the system prompt, tokens and the context window. You read every part of a response and know what it means.
  • Answers Your Code Can Use. Free text is for people; code needs data. You describe the answer you want as a Pydantic model, receive it as a validated object, ask again when it does not fit, and learn what a schema guarantees and what it leaves to you.
  • Tools. A model cannot know your orders, so it asks: it requests a function call, your code checks the arguments, runs the lookup and sends the result back, and the model answers from real data.
  • Failures and Streams. Calls fail and replies take time. You tell the failures worth retrying from the ones to fix, set timeouts, and stream a reply to the screen as it is written.

Lessons

Where it fits

Course 1 of 3 on the AI Engineer path.

How our courses are made Report a mistake