How ahmadalameri-0/rag_against_the_machine works
This repository is a small retrieval-augmented generation application over a vLLM source corpus. Its workflow indexes source files into validated chunks with character spans, retrieves top-k matches using BM25, then uses those source spans and the query to generate grounded answers with a local Qwen model. The README also documents batch search, answer generation, and recall evaluation. Relationship evidence comes from the README and SOURCE INDEX; implementation details beyond the shown excerpts are not inferred.
Main entry points: generator.py Answer Generator · __main__.py CLI Workflows · retriever.py BM25 Retriever · indexer.py Indexer and Chunker
Components 12
Indexing
- vLLM Corpus
data/raw/vllm-0.10.1 - Indexer and Chunker
src/indexer.py - Processed Index
Retrieval
- BM25 Retriever
src/retriever.py - Ranked Source Spans
Generation
- Answer Generator
src/generator.py - Qwen Model
- Grounded Answer
Schemas and CLI
- Pydantic Schemas
src/models.py - CLI Workflows
src/__main__.py - Recall Evaluation
src
Other components
- User
Connections 18
- User → CLI Workflows: runs commands
- CLI Workflows → Indexer and Chunker: starts indexing
src/__main__.py - vLLM Corpus → Indexer and Chunker: provides files
- Indexer and Chunker → Processed Index: persists chunks
- CLI Workflows → BM25 Retriever: starts search
src/__main__.py - Processed Index → BM25 Retriever: supplies chunks
- BM25 Retriever → Ranked Source Spans: ranks top-k
- CLI Workflows → Answer Generator: starts answering
- Ranked Source Spans → Answer Generator: provides spans
- User → Answer Generator: provides query
- Answer Generator → Qwen Model: prompts model
- Qwen Model → Grounded Answer: generates answer
- Answer Generator → Grounded Answer: formats result
- Indexer and Chunker → Pydantic Schemas: validates chunks
- BM25 Retriever → Pydantic Schemas: validates results
src/retriever.py - Answer Generator → Pydantic Schemas: validates answer
src/generator.py - CLI Workflows → Recall Evaluation: runs evaluation
src/__main__.py - BM25 Retriever → Recall Evaluation: provides rankings
src/retriever.py