# Working with AI: The Basics

> A free course on how AI assistants work: how a model writes an answer, tokens, chat memory, tools and agents, reasoning, checking the result and giving the model a task.

A free course from the school promt.engineer: 8 lessons of 10–15 minutes, with self-check questions at the end of each. Course page: https://promt.engineer/en/course/

## Lessons

1. [How a language model writes an answer](https://promt.engineer/en/lessons/1/index.md): What happens between a question and its answer, where the model gets this ability, and why the answers differ each time.
2. [Tokens: the pieces the model builds text from](https://promt.engineer/en/lessons/2/index.md): How the model sees text, why it finds counting letters hard, and why limits and prices are counted in tokens.
3. [Chat and memory: what the model remembers from a conversation](https://promt.engineer/en/lessons/3/index.md): What the model receives with each message, why long conversations go wrong, and how an assistant’s memory works.
4. [What the model knows and where its mistakes come from](https://promt.engineer/en/lessons/4/index.md): Where the model gets its information, where its knowledge ends, why it invents facts, and why information in the request is more reliable than its memory.
5. [Tools and agents: how the assistant takes actions](https://promt.engineer/en/lessons/5/index.md): How an assistant searches, reads files and runs programs, what an AI agent is, and what you can trust it with.
6. [Reasoning: what it means when “the model is thinking”](https://promt.engineer/en/lessons/6/index.md): What lies behind the words “the model is thinking”, when reasoning helps, what it costs, and why a convincing draft is not yet proof.
7. [Checking the result: how to tell whether you can trust an answer](https://promt.engineer/en/lessons/7/index.md): Which mistakes models make most often, how to catch them, what not to accept without checking, and how to make an answer checkable.
8. [How to give the model a task](https://promt.engineer/en/lessons/8/index.md): What the model needs to know about a task, what a good request is made of, how to correct an answer, and how to give a task to an AI agent.

## How to take the course with your own AI agent

Copy this prompt and give it to your assistant:

```
You are my teacher for the course “Working with AI: The Basics” from the school promt.engineer.

Course materials: https://promt.engineer/en/llms.txt lists the eight lessons with links to their text. Open the lessons one at a time, in order, and rely only on their text. If something is not in a lesson, say so.

How we work:
1. Before each lesson, tell me in two or three sentences what it is about and why it matters at work.
2. Explain the lesson section by section, in your own words, with examples from my work: [briefly describe what you do].
3. After each section, ask me one question to check my understanding and wait for my answer. If I am wrong, explain exactly where.
4. At the end of the lesson, go through its self-check questions: let me answer first, then compare my answer with the lesson’s.
5. Move on to the next lesson only when I write “next”.

Write in English, briefly and without introductions. Start with the first lesson.
```

## Course dictionary

- **Input and output tokens**: The tokens the model receives (the message, documents, the conversation) and the tokens it writes (the answer and its reasoning). Through the API they are billed separately; output tokens usually cost several times more.
- **Prompt caching**: Reusing the already processed start of a request: if a request begins the same way as a recent one, that part does not have to be processed again. Through the API it costs 10 to 20 times less, and in a subscription it may use up less of your limit.
- **Large language model**: A program trained to work with text: it takes in text and writes text in response.
- **Token**: A piece of text the model works with: a whole word, part of a word or a punctuation mark.
- **Tokenizer**: A program that splits text into tokens before it reaches the model.
- **Parameters**: The numbers inside a model that its calculations depend on: they determine what probabilities the model gives to the next token.
- **Temperature**: A setting that controls how randomly the model picks the next token: at a low temperature the answers are alike, at a high one they are more varied.
- **System prompt**: Text from the assistant’s developers that the chat app puts before the conversation: who the assistant is, how it should behave, today’s date.
- **Knowledge cutoff**: The point up to which the model’s training texts were collected: the model does not know about later events.
- **Tools**: Actions the app allows the model to take: searching, reading files, running code. The model asks for them, and the app carries them out.
- **AI agent**: An assistant that carries out a task of several steps on its own: the model asks for an action, the program carries it out and returns the result, and so on in a loop.
- **Prompt injection**: An attack in which instructions for the model are hidden in a text it reads: on a web page, in an email or in a document.
- **Reasoning**: A draft the model writes token by token before it answers: the intermediate conclusions in it help with tasks of many steps.
- **Sycophancy**: A model’s tendency to agree with the user: to tailor the answer to the user’s opinion, praise their work and give in when they insist.
- **Context window**: The largest number of tokens the model can take into account at once: the message, documents, the answer and, in a chat, the conversation too.
