DEV Community


Posted on

Hello world of Generative AI - how to build a RAG (Retrieval Augmented Generation) from scratch

Hi folks 🧙‍♂️,

In this blog post series we are going to build a system called RAG which stands for Retrieval Augmented Generation. It's considered a Hello world in Generative AI (although a bit more complex version of it :) ).

A lot of companies are exploring Generative AI as a technology and RAG is a great starting point because you get to combine your internal company documents with large language model capabilities such as ChatGPT.

Seeing AI taking over the world by storm, we as engineers need to be familiar with the main concepts. There are many libraries out there that can build a RAG for you, but they also hide a lot of details thus why I wanted to take a different approach and build a bare-bones RAG system without any libraries - just Python and OpenAI. The main goal is to learn the concepts without getting lost in the weeds.

Here are the two blogs posts with all the code included:
RAG from scratch - part 1
RAG from scratch - part 2

Our RAG system is going to use official company documents from Gitlab and their Handbook. Here is how the final product looks like.

RAG system over Gitlab handbook documents

This is my first post on so I'm happy to hear any feedback. I'm planning to write more around GenerativeAI, so if there is a topic you want to hear more about, please reach out.

Top comments (0)