Module 5.3
Every mechanism from this module (and Module 1) chained into one real pipeline. Step through what actually happens, in order, from raw Nimbus docs to a generated reply.
The code
# one-time: build the index
chunks = [chunk(doc) for doc in nimbus_docs] # Module: AI Concepts Int. 3.1
vectors = [embed(c) for c in chunks] # Module 1.2
index = build_hnsw_index(vectors) # Module 5.1
# per query:
def answer(query):
bm25_hits = bm25_search(query, chunks) # Module 5.2
vector_hits = index.search(embed(query), k=10) # Module 5.1
fused = reciprocal_rank_fusion([bm25_hits, vector_hits])
top_chunks = cross_encoder_rerank(query, fused[:10])[:3] # Module 5.2
prompt = assemble_prompt(system_instructions, top_chunks, query)
return gpt_forward(prompt) # Module 2.3
Every function call in answer() is something this series already built from scratch — RAG isn't a new mechanism, it's a specific order to run the earlier ones in.
The Nimbus thread
Every earlier page's Nimbus material — the corpus, the query, the embeddings, the rankings — was building toward this exact pipeline. Nothing in the final generated answer came from the model "knowing" Nimbus; it came from retrieval finding the right two sentences and a prompt handing them over as context. That's the entire difference between a model that hallucinates a plausible-sounding policy and one that quotes the real one.
So what
RAG isn't one mechanism — it's eight mechanisms this series already covered, run in a specific, deliberate order.