
Explore retrieval augmented generation with embeddings, vector stores, retrievers, and rewriters to empower LLMs and reduce hallucinations, then build a console and web chat app using your chosen model.
download the appropriate go binary from go.dev for windows, mac (apple silicon or intel), or linux, run the installer, follow platform instructions, verify with go version, and update if needed.
Seek help by first searching online, then compare your code to the lecture's source, check the Q&A, and finally share runnable code or a Git link for tailored assistance.
Set up a basic Go web app that connects to an LLM using the official OpenAI Go SDK, with modular folders for app, config, LLM, and chat.
Finish wiring the llm package to enable streaming chat completion in the Go RAG app, implement chat stream, message formatting, delta handling, and resource safeguards.
Set up the chat package to manage a chat session, seed history from a system prompt file, and stream responses via the LLM client in a repl-driven flow.
Enable a system prompt to guide the LLM in your Go-based RAG app by creating prompts/system-custom.md, loading the system_prompt_file, and seeding chat history.
Set up a Postgres 18 vector store for a RAG system in Docker, enabling pgvector and creating a documents table with an embedding vector.
Define a vector store interface in Go to index high-dimensional embeddings for documents and support upsert, query, delete, and close for scalable similarity search.
Implement upsert and query operations for Postgres pgvector store in Go, handling metadata marshaling to JSONB, embedding storage, and top-k retrieval with distance-to-score conversion.
Add database URL and embedding dim to the config, default embedding dim to 768 for nomic embed text, and open a pgVector vector store from the DSN with readiness logs.
Enable the vector back end by configuring the Postgres connection and initializing the pgvector store, then test the run and verify the documents table migration for the RAG server.
Define two Go clients, one for the LLM and one for the embedding model, enabling cloud or local models with separate base URLs and API keys loaded from config.
Set up a chunker to split ingested documents into chunks stored in a Postgres vector database, and configure ingest and processed directories plus an embedding model with sensible defaults.
Set up an ingestion pipeline that reads documents, chunks text into overlapping windows, embeds chunks into vectors, deletes prior chunks, and upserts new chunks into the vector store with metadata.
Wiring the ingestor into the app, this lecture shows creating a cancelable context and an embedder, plus wiring a directory watcher with a wait group and logging for clean shutdown.
Explore building a go-based rag application by loading a nomic embed text model, configuring embedding settings, ingesting documents, and instructing the llm to use the relevant vector store chunks.
Trace how RAG handles a user question through embedding, vector-store retrieval, and a rewriter that shapes the LLM prompt with retrieved chunks and sources.
Integrate the retriever and rewriter into the repl loop by inline-context rewriting the latest user message and passing a turn with embedded excerpts to the LLM via chatStream.
Wire a retriever and a rewriter into app.go to fix the runrepl call, using rag.new and rag.newRewriter with the client, an embedder, and a store.
Set up a local rag app in go by moving the spinner before llm queries, loading documents, and testing a vector store with cosine similarity.
Develop a web version of the chat in Go, enabling document uploads and future image additions to a vector store, using embedded Go templates and HTTP routes.
Wire the chat page into the go web app by configuring http addr, images dir, and vision model, then start the web server to display the chat at localhost:8080/chat.
Implement a streaming chat with a new http route /api/chat/stream, render the chat history, use server-sent events for live updates, and integrate a retriever to enrich user prompts.
Wire up app.go, run the web server on port 8080, test chat interactions with a markdown-rendered LLM response, and preview enabling file uploads to the document and vector stores.
Enable users to upload files through the web interface, ingesting content into the vector store for the RAG system by chunking, embedding, and returning a JSON summary.
Upload an image to the vector store, verify it in Postgres, fix formatting, and update prompts to render images in RAG results with markdown.
Set up a vision route and caption handler in go, posting to /api/caption, parsing multipart form data, validating the image, and returning a json caption with a description.
Explore image captioning in a go-based rag application by configuring the vision model, uploading images, and generating auto captions through the chat interface.
Wire up the middleware for a RAG-enabled chat in Go, implementing prompt-injection defense with inspect json and inspect multipart, and group routes with chi to apply the defense.
Build a Production-Style RAG System in Go — From Zero to Streaming Chat
Learn Retrieval-Augmented Generation by building one yourself, in plain Go, against any OpenAI-compatible model — local or hosted.
Stop reading about RAG and start shipping it. In this hands-on course you will build a complete, end-to-end Retrieval-Augmented Generation system from the ground up using the Go programming language. No Python. No LangChain. No magical abstractions. Just clear, idiomatic Go code that you can read, modify, and own.
By the end of the course, you will have a working application featuring a streaming terminal chat REPL, a browser-based chat UI with token-by-token Server-Sent Events, file and image uploads, a background filesystem watcher that ingests documents automatically, an evaluation harness that scores retrieval quality, and a Postgres + pgvector backend running in Docker.
Why this course?
Most RAG tutorials hide the interesting parts behind a framework. You wire three lines of someone else's library together, it works, and you have no idea what just happened. When something breaks in production — and it will — you are stuck.
This course takes the opposite approach. Every component is built explicitly, with clean seams between concepts so you can see exactly where the LLM client ends and the vector store begins. The package layout maps directly to lecture chapters. The interfaces between the LLM, the embedder, the vector store, the retriever, the chat loop, and the web server are deliberately exposed so you can swap pieces in and out as exercises.
This is the course I wish existed when I was learning RAG.
What you will build
A small but real RAG application with all the moving parts of a production system:
A streaming chat REPL (Read-Eval-Print Loop) in the terminal with a "thinking" spinner and proper history management
A web chat UI built with chi, Go templates, and Tailwind, streaming tokens to the browser over SSE with in-browser markdown rendering
A background filesystem watcher that detects new documents, chunks them, embeds them, and upserts them into pgvector — then moves the originals out of the way
A synchronous file upload path on the web UI for drag-and-drop ingest with chunk-count feedback
An image upload pipeline with optional auto-captioning by a vision-capable model, served back to the browser and rendered inline in chat
A paragraph-aware chunker with configurable size and overlap
A query rewriter that turns multi-turn conversation into a standalone search query before retrieval
A retriever with cosine-similarity filtering, top-K hit selection, and pluggable backends
A pgvector + Postgres 18 vector store with idempotent migrations, HNSW indexing, and a delete-by-source path that keeps re-ingest clean
What you will learn
How a RAG pipeline actually works end-to-end: chunking, embedding, vector search, query rewriting, context injection, and streaming generation
How to design Go interfaces so the LLM, the embedder, and the vector store are swappable without touching the rest of the codebase
How to stream LLM tokens to a terminal AND to a browser with Server-Sent Events
How to run everything against **OpenAI, Ollama, LM Studio, or Groq** — and how to mix and match (e.g. hosted chat with local embeddings)
How to use Postgres + pgvector for production-grade vector search, including HNSW indexes and embedding-dimension migrations
How to ingest documents reactively with `fsnotify`, debouncing half-written files, and idempotent re-ingest
How to handle multimodal content: image upload, vision-model captioning, and image rendering in chat
How to debug "why didn't the model use my docs?"
What makes this course different
Real code, not pseudo-code. Every example in the course is from a working, runnable project.
Local-first. You can complete the entire course with Ollama on your laptop. No API bills required.
Honest about tradeoffs. The course covers known limitations (chunker is token-blind, delete-then-upsert is not transactional, image retrieval is description-based) so you understand the design space, not just one fixed answer.
Tech stack you will use
Go, Postgres 18, pgvector, Docker Compose, chi router, Go templates, Tailwind, Server-Sent Events, fsnotify, OpenAI-compatible APIs (works with OpenAI, Ollama, LM Studio, Groq, and others).
Course outcome
When you finish this course, you will have a portfolio-quality RAG application running on your machine, a deep understanding of how every layer works, and the confidence to drop the same architecture into a real product at work. You will know what to measure, what to swap, and what to leave alone.
Enrol now and start building your own RAG system today.