From the course: Hands-On AI: Build a RAG Model from Scratch with Open Source

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Preparing context, part 1

Preparing context, part 1

- [Instructor] We're nearing home stretch and we're almost done completing the pipeline engineering necessary for our RAG model. So, one of the last steps is ensuring that we're able to pull five unique context windows with context relating to the query being posed. And so, we're gonna go ahead and create a new file called prepare_content where we're gonna do exactly that. So, let's quickly go over exactly what we wanna achieve here. We wanna first pull in much more than five search results in case there's overlap. And then from there we want to consolidate any that have overlap so that we're left with five unique context windows. And that's it in a nutshell. So, let's go ahead and bring in some imports, all which we've already seen. Now, let's go ahead and work on our first function. Our first gonna be a simple helper function, which is just gonna help us identify if a current match is part of the context window of…

Contents