How ehsanghaderian/rag-langchain-huggingface works
This is a compact, script-driven RAG application: it loads local text, chunks and embeds it into a local Chroma store, retrieves passages for a question, builds context, and asks a hosted Hugging Face model for an answer. The main workflow is visible in rag.py; the README documents broader evaluation and scoring possibilities, but the sampled script does not implement a separate evaluation stage. External services and integrations are shown only where the source or README identifies them.
Main entry points: rag.py RAG Script · Book.txt Book Text
Components 12
Document Ingestion
- Document Loader
rag.py - Text Chunker
rag.py - Embedding API
Search and Context
- RAG Script
rag.py - Chroma Store
rag.py - Similarity Search
rag.py - Context Builder
rag.py
Answer Generation
- Prompt Builder
rag.py - Hosted Qwen LLM
- Generated Answer
rag.py
Other components
- Questioner
- Book Text
Book.txt
Connections 16
- Questioner → RAG Script: asks
rag.py - Book Text → Document Loader: loads text
rag.py - RAG Script → Document Loader: calls
rag.py - RAG Script → Text Chunker: chunks documents
rag.py - RAG Script → Chroma Store: creates store
rag.py - Text Chunker → Chroma Store: stores chunks
rag.py - Embedding API → Chroma Store: embeds chunks
rag.py - RAG Script → Similarity Search: searches query
rag.py - Similarity Search → Chroma Store: queries vectors
rag.py - RAG Script → Context Builder: selects passages
rag.py - Similarity Search → Context Builder: returns passages
rag.py - RAG Script → Prompt Builder: combines query
rag.py - Context Builder → Prompt Builder: adds context
rag.py - Prompt Builder → Hosted Qwen LLM: sends prompt
rag.py - RAG Script → Hosted Qwen LLM: invokes model
rag.py - Hosted Qwen LLM → Generated Answer: generates text
rag.py