NLP and Generative AI: Building with Language Models
Turn text into numbers, then build with LLMs: prompting, APIs, structured output, RAG, agents, evaluation and safety, with English and Twi examples.
- 0 students
- 89 lessons
- 7 h 29 min
Created by Ayim Nelson
What you will learn
- Clean and tokenize English and Twi text, and build bag-of-words and TF-IDF features
- Train and evaluate a text classifier with scikit-learn
- Explain embeddings, cosine similarity, tokens, context windows and temperature
- Write clear prompts and prompt templates, and validate JSON replies with pydantic
- Call LLM APIs safely: keys on the server, cost in cedis, retries and tool calling
- Build a retrieval-augmented generation pipeline with a vector search and citations
- Evaluate LLM apps with test sets, retrieval metrics and per-language scores
- Defend against prompt injection and handle personal data under Act 843
About this course
A hands-on course on working with language, from classic NLP to apps built on large language models. You'll turn text into numbers, classify messages with TF-IDF and Naive Bayes, compare meanings with embeddings, then learn how LLMs work and build with them: prompting, API calls, structured output, retrieval-augmented generation (RAG), agents, evaluation and safety. Examples run in your browser, in English and Twi, around Akwaaba Help, a help assistant for a shop in Accra and Kumasi.
For: Python programmers who have finished Machine Learning with scikit-learn (Neural Networks and Deep Learning helps for the Transformer lessons) and want to build real LLM apps that they can test and trust.
By the end: you'll have built a small RAG assistant that screens for prompt injection, retrieves and cites the right policy, refuses when it doesn't know, and is scored on a test set, with the real API and deployment code to take it further on your own computer.
Course content
11 sections · 89 lessons
Text as data10 lessons
- What NLP isPreviewReading · 3 min
- Meet Akwaaba HelpPreviewReading · 3 min
- Cleaning textPreviewReading · 3 min
- Tokens and tokenizingReading · 3 min
- Tokenizing TwiReading · 4 min
- Unicode normalisationReading · 3 min
- Stop wordsReading · 3 min
- Counting wordsReading · 3 min
- n-gramsReading · 3 min
- Tokenize English and Twi messagesExercise · 12 min
Classic NLP8 lessons
- Bag of wordsReading · 4 min
- TF-IDFReading · 4 min
- A Naive Bayes text classifierReading · 4 min
- Sentiment analysisReading · 4 min
- Evaluating a text classifierReading · 4 min
- Low-resource languagesReading · 3 min
- GhanaNLP, Masakhane and AfriSentiReading · 4 min
- Scam-SMS classifierExercise · 14 min
Embeddings and similarity8 lessons
- Words as vectorsReading · 3 min
- Cosine similarityReading · 4 min
- Finding the nearest neighboursReading · 3 min
- Sentence embeddings (shown)Reading · 4 min
- TF-IDF vectors for searchReading · 4 min
- Semantic searchReading · 3 min
- Embedding biasReading · 3 min
- Find the closest FAQExercise · 12 min
How LLMs work10 lessons
- Language models predict the next tokenReading · 4 min
- Generating text one token at a timeReading · 3 min
- Subword tokens (BPE)Reading · 4 min
- Real tokenizers (shown)Reading · 4 min
- Transformers in one pictureReading · 4 min
- Pre-training and fine-tuningReading · 4 min
- Context windowsReading · 4 min
- Temperature and samplingReading · 4 min
- Why LLMs hallucinateReading · 4 min
- Temperature sampling with a seeded toy modelExercise · 12 min
Prompting8 lessons
- Clear instructionsReading · 3 min
- Roles and system promptsReading · 4 min
- Few-shot examplesReading · 4 min
- Asking for structured output (JSON)Reading · 4 min
- Step-by-step reasoningReading · 3 min
- Delimiters for untrusted textReading · 3 min
- Prompt templates in PythonReading · 4 min
- Build a prompt template functionExercise · 12 min
Calling an LLM API11 lessons
- API keys and keeping them secretReading · 4 min
- A chat request and response (shown)Reading · 5 min
- The same request with other providers (shown)Reading · 4 min
- Tokens and cost in cedisReading · 4 min
- Cutting the billReading · 3 min
- Errors, retries and timeoutsReading · 4 min
- Parsing JSON repliesReading · 4 min
- Validating replies with pydanticReading · 4 min
- Structured output modes (shown)Reading · 4 min
- Tool and function callingReading · 5 min
- Validate model replies with pydanticExercise · 14 min
Retrieval-augmented generation (RAG)8 lessons
- Why RAGReading · 4 min
- Chunking documentsReading · 4 min
- Indexing the chunksReading · 4 min
- Retrieving the top kReading · 4 min
- Building the prompt with sourcesReading · 4 min
- Citing sources and saying I don't knowReading · 4 min
- Vector databases (shown)Reading · 4 min
- Mini RAG over Akwaaba policiesExercise · 15 min
Agents and tools6 lessons
- What an agent isReading · 3 min
- The tool-use loopReading · 5 min
- Giving tools safelyReading · 4 min
- MCP in brief (shown)Reading · 4 min
- When not to build an agentReading · 3 min
- A rule-based agent loop with a fake modelExercise · 15 min
Evaluating LLM apps7 lessons
- Why it looks right is not enoughReading · 3 min
- Test sets for promptsReading · 4 min
- Exact-match and keyword checksReading · 4 min
- Retrieval metricsReading · 4 min
- LLM-as-judge and its limitsReading · 4 min
- Regression tests with pytest (shown)Reading · 4 min
- Score the RAG answersExercise · 14 min
Safety and responsible AI8 lessons
- Prompt injectionReading · 4 min
- Defending against prompt injectionReading · 4 min
- Personal data and Act 843Reading · 4 min
- Bias and Ghanaian languagesReading · 4 min
- Content moderationReading · 3 min
- Human in the loopReading · 3 min
- Ghana's AI strategy and the AU strategyReading · 3 min
- Catch the injected instructionExercise · 14 min
Final project5 lessons
- Project brief: Akwaaba HelpReading · 4 min
- Deploying with FastAPI (shown)Reading · 5 min
- Final project: Akwaaba HelpExercise · 20 min
- Where to go nextReading · 3 min
- Final quizQuiz · 8 min
Reviews
No reviews yet.
Comments
Log in to join the conversation.
Loading comments...