7–10 days
Part 2 — AI Core
Learn to talk to LLMs, handle their responses, and shape their behaviour.
0%
7–10 days0/4 topics done0/10 tasks done
Topics
What to learn
- The messages array format — role: 'user' and role: 'assistant'
- The system prompt — sets AI's behaviour before the conversation starts
- max_tokens — always set this or you'll get surprise bills
- Calling the API from a Next.js API route (server-side, never browser)
- Handling the response — response.content[0].text
- Rate limits and error handling — wrap every call in try/catch
What to learn
- stream: true in the API call
- ReadableStream and TransformStream in Next.js
- Vercel AI SDK — streamText, useChat hook (abstracts most streaming complexity)
- Displaying streamed text in React as it arrives
- Handling stream errors gracefully
What to learn
- System prompts: set persona, tone, and constraints — be specific
- Output formatting: ask for JSON, use XML tags to separate sections
- Few-shot examples: show the model 2-3 examples of good output
- Chain of thought: 'Think step by step before answering'
- Common mistakes: vague instructions, no output format, untested prompts
What to learn
- Defining tools — name, description, and input schema (JSON Schema)
- The tool call loop — AI responds with a tool call, you run the function, send result back
- When to use tools vs when to just prompt
- Parallel tool calls — the AI can call multiple tools at once
Assignment
Assignment
Assignment 2 — AI Chat App with Tools
0%0/10
You just built the skeleton of a real SaaS product. Auth + AI + database + payments + rate limiting is the full pattern.
Build Requirements
Acceptance Criteria
Notes
My Notes
Saved