honestsoul/rag_patterns — explained in plain English
Analysis updated 2026-05-18
Learn how hybrid, graph-based, agentic, corrective, and multimodal RAG pipelines are structured.
Study a from-scratch BM25 keyword search implementation alongside vector similarity search.
Use the graph-based script as a starting point for building a knowledge graph from entities and relationships.
| honestsoul/rag_patterns | adityasharmadotai-hash/docs-reader-rag-agent | alekseiul/hermes-researcher-agent | |
|---|---|---|---|
| Stars | 29 | 29 | 29 |
| Language | Python | Python | Python |
| Setup difficulty | easy | easy | moderate |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | developer | vibe coder | researcher |
Figures from each repo's GitHub metadata at analysis time.
Only numpy and networkx are required, no API keys since models and embeddings are simulated.
This repository is a teaching collection of five small Python scripts, each one showing a different way to wire up a Retrieval-Augmented Generation system. RAG, in plain terms, is the technique of looking things up from a document store and then handing those snippets to a language model so it can write a better answer. The five scripts are kept simple on purpose: nothing calls a real cloud model, no API keys are needed, and the embeddings and LLM responses are faked with deterministic random numbers. The point is to see the shape of each pipeline, not to measure quality. The first script, hybrid RAG, runs two searches at once over the same documents. One uses dense vector similarity (the kind powered by neural embeddings) and the other uses BM25, a classic keyword scoring method written from scratch here. The two ranked lists are merged with Reciprocal Rank Fusion and the top results go to the model. The second script builds a knowledge graph with the networkx library, where people, companies, technologies, and locations become nodes and verbs like founded or ceo_of become labelled edges. A query first extracts entities, then walks the graph a few hops to gather a subgraph, then summarises that subgraph before sending it to the model. The third script, agentic RAG, sets up a planner that picks tools to call (vector search, web search, or SQL), runs them in a loop until confidence is high enough, and then asks a reasoner agent to write the final answer. The fourth script, corrective RAG, scores the retrieved chunks and branches on the verdict: keep them, rewrite the query and try again, or fall back to a simulated web search. The fifth script is multimodal, mapping text chunks, image captions, and tables into one shared vector space and re-ranking by the modality the query asks for. Dependencies are just numpy and networkx.
Five simple Python scripts that each demonstrate a different Retrieval-Augmented Generation pattern, with no API keys or real models needed.
Mainly Python. The stack also includes Python, NumPy, NetworkX.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.