AI Book Tutorial menu

How to Use This Book

This chapter shows you how the book is organised and how to set up your computer for the examples.

Who This Book Is For

This book is for anyone who wants to understand AI and use it well, not only chat with it:

  • Students who want to know what is happening inside a chatbot
  • Developers who want to add AI features to their apps
  • Freelancers and small business owners who want to save time and earn more
  • Teachers and office workers who want to use AI safely

You do not need advanced maths. When we show a formula, we also show what it means in plain words.

How the Book Is Organised

PartWhat you learnDo you need code?
AI Book TutorialHow to use the book, what AI really is todayNo
Part 1: How LLMs WorkTokens, embeddings, attention, trainingA little Python
Part 2: Building with AIAPIs, JSON, RAG, vector databases, tools, MCP, testingYes, Python and Node.js
Part 3: AI at WorkCoding assistants, freelancing, careersSome
Part 4: Safety and the FuturePrivacy, hallucinations, prompt injection, the road aheadA little

You can read it from start to end like a book. You can also jump to one part. If you are not a programmer, read Part 1, Part 3 and Part 4, and skim Part 2.

This Book and the Other AI Tutorials

Workownix has other free AI tutorials. This book links to them instead of repeating them:

If you want...Read
A gentle first look at AI and its historyAI Tutorial
How text, image and audio generation worksGen AI Tutorial
How to write better promptsPrompt Engineering Tutorial
A complete website chatbotChatbots Tutorial
Agents that plan and use toolsAI Agents Tutorial
Classic machine learning with dataMachine Learning Tutorial

Setting Up Your Computer

For the code chapters you need:

  1. Python 3.10 or newer (see the Python Tutorial)
  2. Node.js 20 or newer (see the Node.js Tutorial)
  3. The NumPy library: pip install numpy
  4. A code editor such as VS Code

Many examples run fully offline on your computer. The examples that call a real AI model need an account with an AI provider.

Check your Python setup with this small script:

Example

python
import sys, os

print("Python version:", sys.version.split()[0])
print("Python 3.10 or newer:", sys.version_info >= (3, 10))
for name in ["AI_API_KEY", "AI_BASE_URL", "AI_MODEL"]:
    print(name, "is set" if os.environ.get(name) else "is MISSING")
Output
Python version: 3.13.16
Python 3.10 or newer: True
AI_API_KEY is MISSING
AI_BASE_URL is MISSING
AI_MODEL is MISSING

Your version number may be different. "MISSING" is normal until you add your settings.

Your Three AI Settings

Every API example in this book reads three settings from environment variables. This keeps your secret key out of your code. Create a file named .env in your project folder:

Example

text
AI_API_KEY=paste-your-key-here
AI_BASE_URL=https://api.example-provider.com/v1
AI_MODEL=the-model-name-from-your-provider

And make sure Git never uploads it, by adding this line to a file named .gitignore:

Example

text
.env

The base URL and the model name come from your provider's documentation. We use these placeholders on purpose: model names change every few months, but the way you call them stays the same.

Never paste a real API key into a chat, a screenshot or a GitHub repository. Anyone who has it can spend your money.

How Each Chapter Works

Every chapter has a short introduction, examples with their real output, notes like the blue box above, and an exercise at the end. The last chapter is a quiz on the whole book.

Exercise

Exercise

Why does this book keep the API key in an environment variable?

Learn AI Book with a teacher

Join the AI & Prompt Engineering course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp