From RAGs to Riches!
1. From RAGs to Riches!
Hi, and welcome to the course!2. Meet your instructor!
I'm JP, Senior Developer Educator at Weaviate, and I'll be your instructor for the course.3. The journey ahead
In this course, you'll learn to create a robust AI assistant that can retrieve information from documents in the form of text and even images, and answer questions about them. To do all this,4. Weaviate
we'll be using Weaviate, which is an open-source, cloud-native vector database. One of its major use cases is for enabling powerful RAG applications. Before we dive into Weaviate, let's briefly recap Retrieval Augmented Generation, or RAG.5. RAG in a nutshell
Put simply, RAG is the process or retrieving relevant context - the "R" in RAG - inserting it into a prompt to create an enriched or augmented prompt for an LLM - the "A" in RAG - and using it to generate new text using this context - the "G" in RAG. Let's zoom into the document retrieval part, as this is the most nuanced part of the process.6. Text embeddings
To store and retrieve documents, we'll utilize the concept of embeddings. For now, we'll consider only text embeddings, but stay tuned for Chapter 3 to discuss image embeddings. Text embeddings can be thought of as numerical representations of text, and they encode the semantic meaning of the text. That is, the text "peach" and "banana" will have more similar embeddings than "peach" and "laptop". When we embed a piece of text, we convert it into a vector, which just means a series of numbers, that represents the text.7. Visualizing text embeddings
Embeddings essentially map text into a high dimensional space equal to the length of the vector. So an embedding model that generates 100 numbers maps the text into 100-dimensional space! As humans, we can't visualize this number of dimensions, but this is a 2D representation of how the vectors we've discussed might be mapped.8. Consistent vector length
Regardless of the length of an input document, whether a single word or a paragraph, the embedding model will generate the same length vector.9. Embeddings and retrieval
These vectors are crucial for the retrieval mechanism in a vector RAG application. When a user queries a RAG application, this query is also embedded to create a query vector. This vector is then sent to the vector database, like Weaviate, that is specifically optimized for storing and querying high-dimensional data.10. Embeddings and retrieval
A similarity calculation is performed between the query vector and the embedded documents in the database to identify the most similar vectors, and the documents represented by those vectors are selected for retrieval.11. "R" is for Retrieval
Putting this within the larger picture we started with, these documents are inserted into a prompt designed to encourage the model to use the retrieved context to generate an informed output.12. Coming up!
To kick things off, we'll perform RAG by-hand to get familiar with each component and process in the workflow. In Chapter 2, we'll orchestrate this using Weaviate.13. Course format
Throughout the course, we'll be working side-by-side to tackle exercises, which will be completed in DataLab Notebooks with accompanying videos. DataLab is DataCamp's proprietary cloud-based notebook IDE. If you've used other notebook IDEs, you should find DataLab pretty intuitive; if you're not familiar with notebooks, you can think of a notebook as a series of cells to execute code in. If you run one cell, any variables or libraries defined in that cell will be available in the other cells, and so on. In the exercise, you can either start the video and code-along with us, or you can watch the video first and code afterwards - the choice is yours!14. Course format
You can find detailed information to help you complete the tasks in the instructions section, and in the notebook.15. Let's practice!
Alright, it's time to get stuck into RAG!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.