📝 Blog
by prakas shrestha · Apr 27, 2026
RAG (Retrieval-Augmented Generation) — Beginner देखि Clear हुने Full Guide
Document chunk कसरी हुन्छ? Query आउँदा search कसरी हुन्छ? — Step-by-Step Explanation
Introduction — RAG किन सिक्ने?
आजकल AI chatbot, document search system, company assistant जस्ता धेरै system हरू RAG (Retrieval-Augmented Generation) प्रयोग गरेर बनाइन्छन्।
यदि तपाईं:
- Data Science सिक्दै हुनुहुन्छ
- AI/LLM engineering सिक्न चाहनुहुन्छ
- Chatbot वा document search system बनाउन चाहनुहुन्छ
भने RAG बुझ्नु अत्यन्त जरुरी skill हो।
यो blog मा हामी zero knowledge भएको beginner ले पनि बुझ्ने गरी step-by-step RAG explain गर्नेछौं।
RAG भनेको के हो? (Simple Definition)
RAG = Retrieval + Generation
यसको अर्थ:
- Retrieval → document बाट relevant information खोज्ने
- Generation → LLM ले answer generate गर्ने
Simple शब्दमा:
RAG भनेको AI लाई answer दिनु अघि document बाट सही information खोजेर त्यसको आधारमा answer generate गर्ने system हो।
Real-Life Example बाट बुझौं
Imagine गर्नुहोस्:
- 1000 PDF files
- Company policy
- Research notes
User सोध्छ:
"Sick leave कति दिन पाइन्छ?"
AI ले guess गरेर answer दिनु भन्दा:
- Sick leave related document खोज्छ
- त्यो part पढ्छ
- त्यसको आधारमा answer दिन्छ
यो process नै RAG हो।
RAG System को Main Parts
RAG system मा सामान्यतया यी 5 component हुन्छन्:
- Documents
- Chunking
- Embeddings
- Vector Database
- LLM
Step 1 — Document Loading (Data तयार गर्ने)
पहिले हामीसँग ठूलो document हुन्छ।
Example:
- Leave policy
- Sick leave
- Work from home
यो document ठूलो paragraph मा हुन्छ।
Problem:
Large document direct search गर्दा slow हुन्छ।
त्यसैले next step:
Chunking
Step 2 — Chunking (सबैभन्दा Important Concept)
Chunking भनेको:
ठूलो document लाई साना-साना pieces (chunks) मा split गर्नु।
Example:
Original document:
- Section 1 → Leave policy
- Section 2 → Sick leave
- Section 3 → Work from home
Chunk गरेपछि:
Chunk 1: Leave Policy Employees can take 20 days annual leave. Chunk 2: Sick Leave Employees can take sick leave when ill. Chunk 3: Work From Home Employees can work from home when approved.
Chunk किन बनाइन्छ?
- Search fast हुन्छ
- Relevant part मात्र find हुन्छ
- Memory efficient हुन्छ
- Accuracy बढ्छ
Chunk Size कति हुन्छ?
Typical rule:
- 300–500 words per chunk
- 50–100 overlap
Example:
Chunk 1 → words 1–500 Chunk 2 → words 450–950 Chunk 3 → words 900–1400
Overlap किन?
Important sentence छुट्न नदिन।
Step 3 — Embedding (Text लाई Number बनाउने)
Computer लाई text meaning बुझाउन:
Text लाई vector (numbers) मा convert गरिन्छ।
Example:
Text: "Sick leave allowed when ill" Vector: [0.78, 0.22, 0.19, 0.55]
यो process लाई भनिन्छ: Embedding
Step 4 — Vector Database (Storage)
अब सबै chunk vector लाई Vector Database मा store गरिन्छ।
Common vector databases:
- FAISS
- Pinecone
- Chroma
- Weaviate
Step 5 — Query आउँदा के हुन्छ?
User सोध्छ:
"Sick leave कति दिन पाइन्छ?"
Query Processing — Step-by-Step
Step 1 — Query लाई Vector बनाउने
"Sick leave कति दिन?" → Query Vector
Step 2 — Vector Search
System compare गर्छ:
Chunk 1 → Leave policy Chunk 2 → Sick leave ← MATCH Chunk 3 → Work from home
Step 3 — Relevant Chunk LLM लाई पठाउने
Question: "Sick leave कति दिन?" Context: "Sick leave allowed for 10 days."
Step 4 — Final Answer Generate
Employees can take 10 days sick leave.
Real-Life Simple Analogy
Imagine: तपाईं library मा हुनुहुन्छ।
User सोध्छ:
"Python book कहाँ छ?"
You don't read whole library.
Instead:
- Index search
- Relevant shelf find
- Book open
- Answer give
Library = Vector DB
Search = Retrieval
Answer = Generation
That is RAG.
Simple RAG Pipeline Summary
- Load document
- Split into chunks
- Convert chunks to vectors
- Store in vector database
- Convert query to vector
- Search similar chunks
- Send chunks to LLM
- Generate final answer
Final Summary
If you remember only this — you understand RAG:
- Document split हुन्छ
- Vector बनाइन्छ
- Query search हुन्छ
- LLM answer generate गर्छ
यही नै Full RAG workflow हो।
by prakas shrestha · Apr 13, 2026
📅 2026 को सबैभन्दा Important Programming Language
| ① | Python भनेको के हो? |
| ② | Python को इतिहास |
| ③ | अहिले Python किन यति Important छ? |
| ④ | Python सिक्दाको फाइदाहरू |
| ⑤ | Python कसरी सिक्ने — Step by Step |
| ⑥ | Python Install गर्ने तरिका — Windows, Mac, Linux |
| ⑦ | पहिलो Python Program लेखौं |
| ⑧ | Best Resources — कहाँबाट सिक्ने? |
Python एउटा high-level, general-purpose programming language हो। यो language यति simple छ कि English पढ्न जानेको मान्छेले पनि code बुझ्न सक्छ। अरू languages जस्तो complicated syntax छैन — सिधा र सफा लेखिन्छ।
| 📖 Simple Syntax English जस्तो पढिन्छ — सजिलो |
🔧 General Purpose Web, AI, Data — सबैतिर use |
🆓 Free & Open Source पैसा तिर्नु पर्दैन |
🌍 Cross Platform Windows, Mac, Linux — सबैमा |
Python को सुरुवात एउटा रोचक कथाबाट हुन्छ। Guido van Rossum नाम गरेका Dutch programmer ले Christmas को बिदामा घर बस्दा बोर भएर Python बनाए!
| वर्ष | के भयो? |
|---|---|
| 1989 | Guido van Rossum ले Christmas बिदामा Python develop सुरु गरे |
| 1991 | Python 0.9.0 — पहिलो public release |
| 2000 | Python 2.0 — major features थपिए |
| 2008 | Python 3.0 — complete redesign, अहिले यही use गरिन्छ |
| 2026 (अहिले) | Python 3.13+ — दुनियाको #1 programming language |
2026 मा Python worldको #1 Programming Language बनिसकेको छ। TIOBE Index, Stack Overflow Survey — सबैतिर Python नम्बर एकमा छ। किन?
| Field | Python को भूमिका | Popular Tools |
|---|---|---|
| 🤖 AI / ML | ChatGPT, Gemini जस्ता AI बनाउन | TensorFlow, PyTorch |
| 📊 Data Science | Data analyze र visualize गर्न | Pandas, NumPy, Matplotlib |
| 🌐 Web Development | Backend server बनाउन | Django, FastAPI, Flask |
| ☁️ Cloud / DevOps | AWS Lambda, automation scripts | Boto3, Ansible |
| 🔐 Cybersecurity | Penetration testing, security tools | Scapy, Metasploit |
| 🤖 Automation | Repetitive tasks automate गर्न | Selenium, PyAutoGUI |
Python सिक्नु भनेको career को सबैभन्दा राम्रो investment हो। यहाँ concrete फाइदाहरू छन्:
| 💰 राम्रो तलब Nepal मा Python developer को तलब Rs. 60,000 देखि Rs. 2,00,000+ सम्म हुन्छ। International companies मा $80,000 - $150,000/year सम्म। |
🌍 Remote Job Upwork, Fiverr, Toptal मा Python को काम धेरै छ। घरबाटै विदेशी company मा काम गर्न सकिन्छ। |
| 🚀 Fast Learning अरू languages भन्दा ३ गुना छिटो सिकिन्छ। ३ महिनामा basic Python सिकेर freelancing सुरु गर्न सकिन्छ। |
🤖 AI को भविष्य AI, Machine Learning, Data Science — यी सबैको backbone Python हो। भविष्यमा यी fields को माग झनै बढ्छ। |
Python सिक्न तरिका छ — एकैपटक सबै सिक्न खोज्नु हुँदैन। यो road map follow गर्नुस्:
- Variables, Data Types (int, string, list, dict)
- If-else conditions
- Loops (for, while)
- Functions
- File handling (read/write)
- Object Oriented Programming (OOP)
- Modules र Libraries use गर्न
- Error handling (try/except)
- Virtual environments
- pip install गर्न सिक्ने
| 🌐 Web Dev चाहनु छ? → Django / FastAPI सिक्नुस् |
📊 Data Science? → Pandas, NumPy, Matplotlib |
| 🤖 AI/ML? → TensorFlow, PyTorch, Scikit-learn |
☁️ DevOps/Cloud? → Boto3, Docker, Ansible |
Python install गर्न एकदम सजिलो छ। तपाईंको computer अनुसार तलको guide follow गर्नुस्:
https://www.python.org/downloads/
"Download Python 3.x.x" button थिच्नुस्
② ⚠️ IMPORTANT: "Add Python to PATH" checkbox tick गर्नुस्
③ "Install Now" थिच्नुस्
④ Install complete हुनको लागि wait गर्नुस्
python --version
# Output आउनु पर्छ: Python 3.x.x
pip --version
# Output: pip 24.x.x
# पहिले Homebrew install गर्नुस् (नभएमा)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# अब Python install
brew install python
# Verify
python3 --version
# Output: Python 3.x.x
.pkg file download गरेर install गर्नुस्
# System update गर्नुस्
sudo apt update && sudo apt upgrade -y
# Python install
sudo apt install python3 python3-pip -y
# Verify
python3 --version
# Output: Python 3.x.x
pip3 --version
# Output: pip 24.x.x
Python code लेख्न VS Code (Visual Studio Code) सबैभन्दा popular editor हो। Free छ र बहुत powerful छ।
https://code.visualstudio.com/download
# Step 2: Install Python Extension
VS Code खोल्नुस् → Extensions (Ctrl+Shift+X)
→ "Python" search गर्नुस् → Microsoft को extension install
# Step 3: Ready!
.py file बनाउनुस् → code लेख्नुस् → F5 थिचेर run गर्नुस्
Install भइसकेपछि VS Code मा hello.py नामको file बनाउनुस् र यो code लेख्नुस्:
# 1. Print गर्ने
print("Hellow World!🌍")
# 2. Variable बनाउने
name = "राम"
age = 20
print(f"मेरो नाम {name} हो र उमेर {age} वर्ष छ")
# 3. Simple Calculator
a = 10
b = 5
print(f"add: {a+b}, substract: {a-b}, multiply: {a*b}")
# 4. List (Array)
fruits = ["स्याउ", "केरा", "अम्बा"]
for fruit in fruits:
print(f"फल: {fruit}")
मेरो नाम राम हो र उमेर 20 वर्ष छ
add: 15, substraction: 5, multiply: 50
फल: स्याउ
फल: केरा
फल: अम्बा
| Resource | कस्तो छ? | Cost |
|---|---|---|
| 📺 YouTube — CS50P | Harvard को Python course — Nepali subtitle पनि छ | FREE |
| 🌐 python.org | Official documentation — सबैभन्दा accurate | FREE |
| 💻 freeCodeCamp | Hands-on projects — practical learning | FREE |
| 📚 Udemy | Structured course, certificate पनि पाइन्छ | $10-15 |
| 🎮 Codecademy | Interactive — game जस्तो सिकाउँछ | FREE (basic) |
| 🏆 LeetCode | Interview practice — problems solve गर्न | FREE (basic) |
- रोज practice गर्नुस् — हरेक दिन ३०-४५ मिनेट पुग्छ
- Project बनाउनुस् — Tutorial मात्र नहेरी आफ्नै project बनाउनुस्
- Error देखि नडराउनुस् — Error भनेको सिक्ने अवसर हो
- Community join गर्नुस् — Reddit, Discord मा Python community छ
- GitHub use गर्नुस् — आफ्नो code save गर्न र portfolio बनाउन
Install → Basics → OOP → Libraries → Projects → Jobs 🚀