RAG for Real-World AI Applications

Connect AI to your data for smarter applications

30 lessons4 hr 20 minPlus
Lesson 1 is free now. The rest comes with Plus.

What you'll gain

Build production-grade Retrieval-Augmented Generation systems. Learn to connect AI models to your own data sources, build vector search pipelines, and create AI features that deliver accurate, contextual answers.

Syllabus

30 lessons · 4 hr 20 min

Chapter 2 - A Basic (Naive) RAG Pipeline

16 lessons
5
Gather and Clean Documents with Llama Parse
Now that we have a web application with an interface scaffolded to actually make use of our rag pipeline for something practical, let's start working on the actual pipeline itself. And the first step in any rag pipeline is gathering and cleaning the data that you want to use to supplement the LLM. Now, data could come from absolutely anywhere.
11 min
6
Open Source Alternatives to Llama Parse
In this lesson, let's take a look at a couple of open source alternatives for cleaning up our documents. Pandoc is something that I ran across that, despite the look of their website, actually worked pretty well. Notice right down here, you can see what all document formats it can handle. It can convert to and from Markdown.
6 min
7
All About Chunking for RAG
Before embedding documents, we should break them up into smaller chunks. There are three main reasons for this. Number one, chunking helps us overcome model limitations. Many embedding models and language models have maximum input size constraints. So splitting allows us to process these documents that would otherwise exceed those limits.
5 min
8
Chunk the MDN Docs for our Project
In this lesson, let's chunk up the MDN docs that exist in our project. In order to do that, I'm going to solicit help from our AI agent, specifically from Claude for Sonnet. Here is the prompt that I'm going to give it based on what I think we need. So I say implement a chunking script.
16 min
9
Compare Embedding Models for RAG
Now that we have our documents cleaned and chunked, it's time to start creating vector embeddings for those chunks and storing those vector embeddings inside of a database.
5 min
10
Compare Vector Databases for RAG
In the last lesson, we picked out an embedding model. The next step in the process is to choose a vector database where we can store those embeddings. So why do we need a vector database in the first place? As we already mentioned, embeddings are just a big list of numbers, AKA vectors.
3 min
11
Use AI Agent to Setup a Postgres Database and Drizzle
In this lesson, let's get Postgres set up on local with that PG vector extension. In order to make this work, you will need to install Docker on your machine. If you don't have it already, I've left a link to the website. It's really easy to download and install. Once you have Docker installed inside of our project, create a docker-compose.
12 min
12
Update the Database Schema for Documents and Chunks
In this video, I'm gonna start our agent chat fresh so that we're not working with any previous context. Then we're going to start planning out the database schema, that database architecture together with the agent. To do that most effectively and quickly and naturally for me, I'm going to enable the dictation feature on my machine.
14 min
13
Use AI Agent to Create Database Seed to Store Documents
Now that the database is set up, I'm going to ask the same agent that was working on setting up that database to seed the database with the data from the MDN docs that we already downloaded, as well as those chunks that we've already created.
9 min
14
Create Embeddings and Store in a Vector Database
Now, we're ready to start creating embeddings for our chunks. We've already decided to use Voyage AI to create those embeddings, but we're also going to use the AISDK as a JavaScript library, really a TypeScript library for interacting with Voyage. Why? Well, because AISDK supports tons of different LLM providers out of the box.
15 min
15
Retrieve Semantically Related Content
Now that we have embeddings in our database for all of our different chunks, we can generate an embedding for a question and then search for semantically similar chunks inside of our database. Ultimately, we want to accept that question through the UI, the web app UI that we created a little earlier.
6 min
16
What is Cosine Similarity and Top-K in RAG?
Now that we have the code generated to retrieve document chunks relevant to a user query, let's talk a little bit more about how it works. First inside of the semantic search script, we have this generate question embedding function. This does the exact same thing that we did for each of the chunks to the user's question.
6 min
17
Augment Generative AI Input with Related Content
In this lesson, let's augment an LLM generation with our relevant docs. Of course, generating anything with AI means we have to have a provider to do that for us. However, Voyage AI doesn't really generate tags.
16 min
18
Documenting RAG App Scripts and Service Functionality
I know, I know, I told you in this lesson we would hook up our RAG pipeline to our web app interface. But hey, we're not vibe coding here. I don't want to get ahead of myself. I do want to take just a few minutes to go over this readme file that was created by the agent in the last lesson. I think its existence is actually pretty nice.
9 min
19
Hook Up the RAG Pipeline to the Web App
Off camera, I went ahead and prompted an AI agent with CloudForce Sonnet chosen with this prompt. I said I have a RAG pipeline created, see at readme. markdown, which points to that scripts readme that we just looked at in the last lesson, and an API UI pointing it to the source directory.
13 min
20
Streaming The RAG Response With the AI-SDK
🚧 **This lesson is coming soon.** Stay tuned — new content is added regularly. You'll be notified when this lesson is available.
12 min

Chapter 3 - Evaluating RAG Results

5 lessons
21
Criteria for Evaluating RAG Results
Now that we have a working RAG pipeline, let's talk about evaluating its effectiveness so that we can systematically improve its output over time.
5 min
22
Get Started with PromptFoo for RAG Evals
In order to evaluate our RAG pipeline, we're going to use a tool called PromptFu. You can get started with PromptFu at promptfu. dev. That's the page that you see in front of you right now. It has lots of different features available, including red teaming, guardrails, model security, MCP, as well as evaluations.
11 min
23
Evaluate RAG Context Recall: Retrieval Effectiveness
In this lesson, let's run a context-based eval. Specifically, let's check the context recall to see if the expected documents are recalled or returned from the database based on a question that we ask. I've already written a little code to demonstrate this to you inside of the evaluation, and then to-retrieval-eval-deterministic folder.
7 min
24
Evaluate RAG Context Adherence-Faithfulness
In this lesson, let's talk about the context-faithfulness assertion in PromptVue and write a test using this assertion type in our code. So first off, note that context-faithfulness is useful for checking if the LLM's response only makes claims that are supported by the provided context.
10 min
25
An Eval to Check for Linked Sources and Some Refactoring
In this lesson, I want to introduce you to a new eval, as well as some refactors I made to clean up our application. Okay, so let me show you how it started. It started with me adding this new eval, which is more of a custom eval. It doesn't fit into the category of context faithfulness or factuality.
6 min

Certificate

Preview
unlearn
Certificate of completion
Your name
RAG for Real-World AI Applications

Shareable, with a public verification link.

Finish all 30 lessons to claim it.

Access

It's part of Plus. Lesson 1 is free to watch for everyone, no account needed.

Every lesson of every course, the full notes, transcripts and prompts, and the Unlearn-built tools. Blog posts and the tools that are public on GitHub stay free for everyone.

Yes. Finish all 30 lessons to earn the RAG for Real-World AI Applications certificate.

Yes. Team plans can assign this course, or a whole role, and follow progress in Team.

Next step

More in Agents and context
The Future Proof Dev: An Intro to AI for Web Developers
Full course · 11 lessons · 1 hr 7 min
Go to the next step